Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Random problems with PDF-export: zero sized PDFs

Valorous Hero ,
Oct 30, 2016 Oct 30, 2016

Dear forum,

I wrote a script that batch processes folders which contain CSV-files and images. Reading the information from CSV-files, it creates documents from templates, places images, enters text data and finally exports them to PDF-files using exportFile method.

On rare occasions, this results in zero sized PDFs which obviously doesn’t open in Acrobat; sometimes in almost zero sized PDFs which opens in Acrobat but most objects are missing.

1.png

I handled this situation by script: right after export it checks for the size of the pdf-file and if it’s below a certain limit, it writes an error message into the log file on the desktop so the user could know about the problem and reprocess the problematic files.

2.jpg

However, I’d like to polish it up. Any ideas about why it happens and how to solve it? The script was used in InDesign CC 2015.4 on Windows 10 with enough free disk space and other resources.

Regards,
Kasyan

TOPICS
Scripting
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 31, 2016 Oct 31, 2016

Hi Kasyan,

I can offer not much.

Just some questions:
1. Can you make out some mutual characteristics for documents that fail to export?
Placed Adobe Illustrator files come to my mind. ( We had some problems with placed AI files and PDF export by scripting in the past. )

2. What does the user do while a document is exported?
Clicking around in InDesign because the export does not happen in the background like usual?

Switching to a different app doing some work there?

3. Are there any web browser apps open while InDesign is exporting the PDFs?
I read here in the forums, that some browser plug-ins or extras could influence InDesign…

Best,

Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 31, 2016 Oct 31, 2016
LATEST

Thank you all guys for the quick reply!

@Uwe

  1. All documents contain only placed jpeg-files and some text. A document, in most cases, has about 40 pages with 4-12 images per page. I don’t see any dependency because the problem occurred only once on my side and the heaviest file (12 images per page) was exported successfully then. My client tested it on two machines -- on Windows 10 and the latest version of InDesign – and experienced this issue from time to time.
  2. The client has a dedicated machine for the purpose: nobody is using it while the script is running. I also didn’t use my computer while testing the script.
  3. I don’t remember if the browser was open during the problematic test. Usually I keep Firefox open and have some add-ons installed. Closing all unnecessary apps before running the script is a good idea.

@Trevor

No, the document is closed only after the export is complete and I don’t quit InDesign by script. Here’s the relative function:

function ExportPDF(doc, obj) {

    try {

        var pdfFile = new File(obj.pdfExportFolderPath + obj.schoolNameShort + ((obj.product == "Class order summary") ? "" : " - " + obj.classNameShort ) + " - " + obj.product + " - Print Files.pdf");

        app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;

        progressTxt1.text = "Exporting PDF-file: " + pdfFile.displayName;

        doc.exportFile(ExportFormat.PDF_TYPE, pdfFile, false, pdfPreset);

        if (pdfFile.length < pdfSizeLimit) {

            LogError("Failed to export pdf-file: '" + pdfFile.fsName + "'; file size is less then " + pdfSizeLimit / 1000 + " Kb");

        }

       

        if (set.cbSaveInDesignFilesValue) {

            doc.close(SaveOptions.YES);

        }

        else {

            doc.close(SaveOptions.NO);

        }

    }

    catch(err) {

        try {

            LogError("Error: " + err.message + ", file: " + doc.name + ", function 'ExportPDF', line: " + err.line);

            $.writeln(err.message + ", line: " + err.line);

            doc.close(SaveOptions.NO);

        }

        catch(err) {

            $.writeln(err.message + ", line: " + err.line);

        }

    }

}

@Loic

The preset used is the built-in "[Press Quality]". As far as I know, they don’t print this in a printing shop.

@La0s

In this script I don’t use Background Tasks – or asynchronous export in scripting terms: asynchronousExportFile() – since according to my testing, in total, it takes the same time as exportFile(). I was also unable to close a document after a background task was complete so with a great number of documents open simply InDesign crashed.

Regards,
Kasyan

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Oct 31, 2016 Oct 31, 2016

Hi Kas,

Maybe you are closing the document or InDesign before the PDF export is done?

Regards

Trevor

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Oct 31, 2016 Oct 31, 2016

I got a similar issue with a client. I used a PDF/X-1a preset to ensure transparency was flattened and it worked fine for 99,999% of the files. But then recently one outputted 0K0 pdfs. I suspect that the combination of spots colors in the document corrupted the PDF export. As the RIP was APPE compliant, I set the PDFX to PDF/X-4 and then the problem went away.

I didn't have time to go deeper on that issue but at least the files are now correctly outputted. But if the RIP was a ghostscript one, I think it would have needed deeper analysis.

FWIW

Loic

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 31, 2016 Oct 31, 2016

I think i had a similar problem that was related to InDesign Background Tasks.

As Trevor mentioned, the documents could possibly be closed before the background tasks are finnished. I solved it then by using Marijan Tompas Background Export Toggle Script.

I cant find it now at his site, but here is a download link:

http://www.existonline.com.au/disable-adobe-indesign-background-tasks/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines