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!
Problem with a PDF file and DrawImage |
Post Reply |
Author | |
tropenix
Beginner Joined: 11 Mar 12 Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 13 Mar 12 at 6:42PM |
I'm testing quickpdf activex with VB6 before to buy.
With same PDF files (generated from Crystal report export to pdf) the DrawImage function does not work correctly. The image is inserted with
very small dimensions, as well as with DrawText function why? ORIGINAL PDF http://www.gibelsoftware.it/referto.pdf MODIFIED PDF http://www.gibelsoftware.it/refertoout.pdf thanks |
|
edvoigt
Senior Member Joined: 26 Mar 11 Location: Berlin, Germany Status: Offline Points: 111 |
Post Options
Thanks(0)
|
Hi,
I see in your second PDF near to lower left corner a small image. But without seeing your code snippet nobody may help you. Inside the refertoout.pdf I see no trace of drawing with QuickPDF. Cheers, Werner |
|
tropenix
Beginner Joined: 11 Mar 12 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
The small image is the image insert by code, but does not respect the coordinates and dimensions FP = QP.LoadFromFile(FileNameout, "") thank tropenix |
|
edvoigt
Senior Member Joined: 26 Mar 11 Location: Berlin, Germany Status: Offline Points: 111 |
Post Options
Thanks(0)
|
Hi tropenix,
it is rather clear. You use QP.ImageWidth and QP.ImageHeight without thinking about the measurementunits. Both functions will give pixels. But inside your PDF you work with millimeters or points (default). QP.DrawImage 100 , 100 , lWidth , lHeight uses the pixelvalues (I guess 48x50 px) as point. A point is here defined as inch/72. An inch is 25.4 mm, so 48 points are 16.9 mm. If I see your refertoout.pdf in Adobe Reader, the image has big white borders, so it looks smaller, as it is. Not good for tests. And its posisition is not 100,100 from SetOrigin(1), which means topleft. It is so, because SetOrigin has to be used after Loadfromfile, origin is set for a document and not over boundaries for all of them. What is to do? It depends only what you want. It's now your job, to calculate from pixelvalues to the wished scaling of images. Look to SetMeasurementUnits-function. I wrote: Inside the refertoout.pdf I see no trace of drawing with QuickPDF. I do not see too the text "PROVA DI INSERIMENTO TESTO" in . Because there SetOrigin is on right place, use a bigger y-value. The referencepoint is on baseline, not on top of text. Cheers, Werner |
|
tropenix
Beginner Joined: 11 Mar 12 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi edvoigt, My proble is: I merge any pdf document, and i must add text adn images on merged file. the code tested add correctly text and image on some pages but not in others
|
|
edvoigt
Senior Member Joined: 26 Mar 11 Location: Berlin, Germany Status: Offline Points: 111 |
Post Options
Thanks(0)
|
Hi,
I did a look inside of refertoout.pdf. There are the internals generated from Drawtext and Drawimage. BT 1 0 0 1 100 831 Tm (PROVA DI INSERIMENTO TESTO)Tj ET q 121.92 0 0 127 254 460 cm /QuickPDFIm79863349 Do Q The text should be drawn sharp on the upper border which is at 841 points. So his height has to be not more than 10 points. Ok. But it is other. As I zoom with Adobe Reader to 1600% I see your text and image down in lower left corner. So I got another idea about the error-source. Its not in your code, but in the PDF, you want to modify. To proof this, take another input-PDF (made not with the program wich produces referto.pdf). And it explains that you have the problem by random. I had such effects with same PDFs, whith incorect commands inside. To be more sure against this, set all normally defaults directly before doing your output. This is as first font and its size and measureunits. You have rather the same situation as a subroutine would use unallowed global values and after its call all goes wrong. Here is the programmer of the PDF-source the bad gay. Cheers Werner |
|
edvoigt
Senior Member Joined: 26 Mar 11 Location: Berlin, Germany Status: Offline Points: 111 |
Post Options
Thanks(0)
|
Hi,
here is a solution. Because the PDF has bad code inside, we try to correct it. QP.LoadFromFile('problematic.pdf',''); QP.NormalizePage(0); // brings some "health" in the page // the world is now ok again QP.SetMeasurementUnits(0); // unit mm QP.SetOrigin(1); QP.AddImageFromFile('blueFolder.bmp', 0); QP.DrawText(100, 10, 'This text should be at 100,10'); QP.DrawImage(100,100, QP.ImageWidth, QP.ImageHeight); QP.SaveToFile('refer.pdf'); Normalizepage works with this pdf from you. But be careful. Werner |
|
tropenix
Beginner Joined: 11 Mar 12 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi,
thanks for your replay.
I had correct all pages of my pdf.
Now position text and image are correctly
very good
thanks Tropenix
|
|
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