Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
![]() |
missing images from rendered PDF |
Post Reply ![]() |
Author | |
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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 Edited by Govert |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
chicks ![]() Debenu Quick PDF Library Expert ![]() Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
![]() ![]() ![]() ![]() ![]() |
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. Edited by chicks |
|
![]() |
|
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi!
There are only 13 "streamobjects" inserted... all are eps-files. No jpg or something similar... Best regards, Ingo |
|
![]() |
|
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
chicks ![]() Debenu Quick PDF Library Expert ![]() Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
chicks ![]() Debenu Quick PDF Library Expert ![]() Joined: 29 Oct 05 Location: United States Status: Offline Points: 251 |
![]() ![]() ![]() ![]() ![]() |
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) |
|
![]() |
|
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Govert ![]() Beginner ![]() Joined: 15 Apr 06 Location: Netherlands Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
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; Edited by Govert |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store