Print Page | Close Window

missing images from rendered PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=392
Printed Date: 25 May 24 at 9:23PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: missing images from rendered PDF
Posted By: Govert
Subject: missing images from rendered PDF
Date Posted: 15 Apr 06 at 11:56AM
I am trying iSEDQuickPDF (thanks Chicks!) to replace code that currently uses GhostScript as a render engine. I am programming in Delphi (5) and using the precompiled Delphi units. Here is my first problem: images are missing from a testfile when displayed with the following simplified code snippet:

QP := TiSEDQuickPDF.Create;
Stream := TMemoryStream.Create;
QP.UnlockKey('...my.trial.key...');
QP.LoadFromFile('D:\altona.pdf');
QP.RenderPageToStream(72,1,0, Stream);
Stream.Position := 0;
Form1.Image1.Picture.Bitmap.LoadFromStream(Stream);
...
Stream.Free;
QP.Free;

The testfile can be found here:

http://www.eci.org/eci/downloads/ECI-en/altona_test_suite/Altona_Visual_1v2a_x3.pdf

The image at the top left and at the top right are missing when rendered with the code above.

Question: is this an extreme example of a PDF that is just a bridge too far for iSEDQuickPDF? is my code the proper way to display a PDF with iSEDQuickPDF?

Note I know this is a difficult file and it makes many RIPs fail at several points (but not by skipping images).

Govert



Replies:
Posted By: Ingo
Date Posted: 15 Apr 06 at 3:39PM
Hi!
I've made the same experience with RenderPageToFile.
The top left and top right is missing and bottom, right is a bit different... Sorry. Don't know why.
Perhaps our PDF-Guru Chicks has an idea?
Best regards,
Ingo


Posted By: Govert
Date Posted: 16 Apr 06 at 7:51AM

Update: It appears that most of the other images are also missing when the gdiplus.dll is not available; same result in print output.

Also, FindImages will write the images to (Jpeg) files, except the missing images (iow, they are probably already skipped when the file is read)

Govert



Posted By: Ingo
Date Posted: 16 Apr 06 at 2:28PM
Hi!
Perhaps a first save with QuickPDF is a solution?
I've seen that there're 9 layers... what about to select each layer and render then? ...CombineLayers doesn't make it better...
Best regards,
Ingo


Posted By: Govert
Date Posted: 17 Apr 06 at 8:25AM
Mmm... I have tried it all, but no luck

Save with QuickPDF: gives a good looking copy of the original file, and... same problem when rendered.
Rendering a file with just the layer containing these images didn't help either.

How does iSEDQuickPDF behave generally? If only I knew the conditions for (existing) PDF's to be rendered and printed properly, or if limitations could be defined, I could live with it as iSEDQuickPDF looks attractive enough.

Govert



Posted By: chicks
Date Posted: 17 Apr 06 at 12:15PM
Hi Govert,

Rendering (especially without GDI+) is one of the few areas where this library has unresolved issues (most libs, iText included, don't support rendering at all, due to its complexity).

I don't know Delphi, but suggest that you may want to join one of the source code groups to purchase the source at very low cost, and target the rendering engine for improvements.

Also note that the limitation may be in GDI+ - I don't know whether it supports all image formats.


Posted By: Govert
Date Posted: 17 Apr 06 at 5:50PM
Thanks Chicks. I think I'll first try to find out the format of the problematic images. Well... in fact I found all the images in this test file are problematic for printing. I think I may reduce and simplify the code in my PDFPrintShop by at least 50%; so that does justify some investigation.

Govert


Posted By: Ingo
Date Posted: 18 Apr 06 at 2:28AM
Hi!
There are only 13 "streamobjects" inserted... all are eps-files. No jpg or something similar...
Best regards,
Ingo


Posted By: Govert
Date Posted: 18 Apr 06 at 4:44PM
Yes, thanks. I'll take some more time and try to dive deeper into this. Perhaps follow Chicks' suggestion to join one of the source code groups (if possible).

Govert


Posted By: chicks
Date Posted: 20 Apr 06 at 11:46AM
Another promising option I've been exploring for sophisticated printing of PDFs is the JavaScript PrintParams object. Most of its properties are accessible within Reader, and iSEDQuickPDF makes it very easy to attach JavaScript to a PDF.

Just thinking out loud, but it ought to be possible to set the PrintParams properties once, using a small dummy PDF, then have the settings "stick" to batch print a series of PDFs, which wouldn't need to be modified in any way.

The list of PrintParams properties is long and rich, including page ranges, even/odd printing, n-up printing, print to file, print as image, silent printing, fit to paper size, shrink to fit, etc.

The PrintParams object was made available in Reader 6.0


Posted By: chicks
Date Posted: 20 Apr 06 at 11:56PM
Unfortunately, new security restrictions prevent batch printing, unless each of the files to be printed has the "disclosed" flag set to true. If you are creating all the PDFs to be printed, this isn't an issue, but for G.P. printing of PDFs, it's a non-starter.

This vbscript example (using the ActiveX version of iSEDQuickPDF) shows how to attach a javascript to a PDF, with various print options (6-up printing with borders, optional print-to-file), and silently print it. The printParams object is very rich, so much more can be done.

Dim oQP, key, js
Dim inPath, outPath

key = " -- MY QUICKPDF KEY GOES HERE -- "
inPath = "c:\temp\test.pdf"
outPath = "c:\temp\printtest.pdf"

js = "this.disclosed = true;" + vbCrLf
js = js + "var pp = this.getPrintParams();" + vbCrLf
js = js + "pp.interactive = pp.constants.interactionLevel.automatic;" + vbCrLf
js = js + "pp.binaryOK = true;" + vbCrLf

'-- Set up 2X3 nUp printing with borders and autorotate
js = js + "pp.pageHandling = pp.constants.handling.nUp;" + vbCrLf
js = js + "pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;" + vbCrLf
js = js + "pp.nUpNumPagesH = 2;" + vbCrLf
js = js + "pp.nUpNumPagesV = 3;" + vbCrLf
js = js + "pp.nUpPageBorder = true;" + vbCrLf
js = js + "pp.nUpAutoRotate = true;" + vbCrLf

'-- Print to file as gdi option
'js = js + "pp.fileName = '/c/temp/printtest.prn'" + vbCrLf

'-- Print to file as postscript option
'js = js + "pp.fileName = '/c/temp/printtest.ps'" + vbCrLf
'js = js + "pp.printerName = ''" + vbCrLf

'-- Set printer name option
'js = js + "pp.printerName = 'my printer name'" + vbCrLf

'-- Print already!
js = js + "this.print(pp);" + vbCrLf
js = js + "this.closeDoc();" + vbCrLf

'-- Init iSedQuickPDF
Set oQP = CreateObject("iSED.QuickPDF")

'-- Unlock the PDF library
Call oQP.UnlockKey(key)

Call oQP.LoadFromFile(inPath)

Call oQP.SetOpenActionJavaScript(js)
Call oQP.SaveToFile(outPath)

'-- Cleanup iSEDQuickPDF
set oQP = nothing

Dim cmd, sh, wsx

'-- Launch the PDF in Reader with hidden flag
cmd = "%comspec% /c start acrord32 /h " + outPath
Set sh = CreateObject("WScript.Shell")
Set wsx = sh.Exec(cmd)



Posted By: Govert
Date Posted: 21 Apr 06 at 2:45AM
Super Chicks. I must say that I hesitate a bit to use Acrobat or the reader for printing, but I'll definitely experiment with this script.

Govert


Posted By: Govert
Date Posted: 26 Apr 06 at 3:27PM
And now in Delphi....

procedure TForm1.Button1Click(Sender: TObject);
var
   S, InPath, OutPath, cmd : string;
begin
InPath := 'd:\an-9012.pdf';           //just one of my test samples
OutPath := 'd:\printtest.pdf';
S :=
'this.disclosed = true;'#13#10 +
'var pp = this.getPrintParams();'#13#10 +
'pp.interactive = pp.constants.interactionLevel.automatic;'#13#10 +
'pp.binaryOK = true;'#13#10 +
//Set up 2X3 nUp printing with borders and autorotate
'pp.pageHandling = pp.constants.handling.nUp;'#13#10 +
'pp.nUpPageOrders = pp.constants.nUpPageOrders.Vertical;'#13#10 +
'pp.nUpNumPagesH = 2;'#13#10 +
'pp.nUpNumPagesV = 3;'#13#10 +
'pp.nUpPageBorder = true;'#13#10 +
'pp.nUpAutoRotate = true;'#13#10 +
//Set printer name option (using PDFCreator here to save trees...)
'pp.printerName = ''PDFCreator'';'#13#10 +
'this.print(pp);'#13#10 +
'this.closeDoc();'#13#10;
//(QP is created and iSEDQuickPDF unlocked when the form is created)
QP.LoadFromFile(InPath);
QP.SetOpenActionJavaScript(S);
QP.SaveToFile(OutPath);
//Launch the PDF in Reader
cmd := 'C:\Program Files\Adobe\Acrobat 7.0\Reader\acrord32.exe /h d:\printtest.pdf';
WinExecAndWait32V2(cmd, SW_SHOW);   //a function defined elsewhere
end;



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk