PDFs created by pdf_output plugin are too big

I am finding that PDFs created using the pdf_output plugin are around 10X larger (file size) than if I create the exact same PDF by printing to a PDF printer.

In other words I get a 900K file when I do this:

	var file = plugins.file.createFile(filename)
	
	var success = plugins.pdf_output.startMetaPrintJob(file);
	if (!success) {
		globals.dialogError('Could not create PDF.')
		return;
	}
	
	//to print current record without printdialog to pdf file
	reportForm.controller.print(true,false,plugins.pdf_output.getPDFPrinter());
	
	plugins.pdf_output.endMetaPrintJob();

but a 90K file when I do this:

reportForm.controller.print(true,false,”PdfCreator”);

Any idea why this is and can it be avoided? It’s a problem for one of my clients.

Thanks a lot.

reportForm.controller.print(true,false,”PdfCreator”);

that “PdfCreator” is something that is not used at all, so very misleading in the example

What you do there is just print to the default printer on your system, and i guess that is the pdf printer that you installed?

But thats a completely different thing, that can generate totally different output yes.

use the pdf Pro plugin (on ServoyForge,) to compress PDF’s! (That’s what happens also in your local installed PDF printer, I guess)
You will be amazed how that plugin, can shrink Pdf’s!!

I downloaded pdf_pro_plugin (thank you SCOTT BUTLER for writing it and HARJO for suggesting it) and it does a nice job of compressing PDFs.

After it has created the compressed copy of the pdf, I want to delete the original pdf and rename the compressed version to the original name. But the .deleteFile() function is failing (returns false). It seems like pdf_pro isn’t letting go of the original file after compressing it. Using Process Explorer I see that servoy.exe still has the original PDF file open right after the .compress() has happened.

Any suggestions/ideas would be much appreciated? Thanks.

Here is my code:

      var fileUnCompressed = plugins.file.showFileOpenDialog();
      var originalFileName = fileUnCompressed.getName()
      var compressedFileName = plugins.servoyguy_pdf_pro.compress(fileUnCompressed);
            
      var fileCompressed = plugins.file.convertToJSFile(compressedFileName);


      if (fileUnCompressed.exists()){
            if(!fileUnCompressed.deleteFile()){
                  globals.dialogError('Error: Can not delete the original pdf')    <------code always ends up here
            }           
      }

      if(!fileCompressed.renameTo(originalFileName)){
            globals.dialogError('Error: Can not rename compressed pdf')
      }

That’s likely a bug. You should probably open an issue on the ServoyForge related project’s tracker: