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!
![]() |
Image doesn't add for each pdf-file |
Post Reply ![]() |
Author | |
Damir ![]() Beginner ![]() Joined: 26 Apr 15 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() Posted: 26 Apr 15 at 2:00PM |
Hi, experts!
I use the next code (VBScript) to add image inside the pdf-file: Dim ClassName Dim LicenseKey Dim FileName ClassName = "DebenuPDFLibrary64AX1114.PDFLibrary" LicenseKey = "****" ' INSERT LICENSE KEY HERE FileName = "C:\Users\damir\Downloads\111\22.pdf" Pic = "C:\Users\damir\Downloads\111\sign.png" Dim DPL Dim Result Set DPL = CreateObject(ClassName) Result = DPL.UnlockKey(LicenseKey) If Result = 1 Then DPL.LoadFromFile FileName , "" d = DPL.AddImageFromFile(Pic, 0) lWidth = DPL.ImageWidth lHeight = DPL.ImageHeight Call DPL.SelectPage(1) h = DPL.PageHeight w = DPL.PageWidth Call DPL.DrawImage(w/2, h/2, lWidth, lHeight) Call DPL.SaveToFile("C:\Users\damir\Downloads\111\SignedFile.pdf") End If Set DPL = Nothing It's works great, but not for each pdf-file. I can understand the reason. The string "d = DPL.AddImageFromFile(Pic, 0)" doesn't return me "0" Non-zero, so it looks like imade adding works. Maybe the reason it's a lot of layouts. Maybe image is under the layout. Please help me!
Edited by Damir - 27 Apr 15 at 6:55PM |
|
![]() |
|
erico ![]() Senior Member ![]() ![]() Joined: 24 Sep 14 Location: Minnesota USA Status: Offline Points: 51 |
![]() ![]() ![]() ![]() ![]() |
You may want to edit your post and remove your license key.
|
|
Eric O
|
|
![]() |
|
Damir ![]() Beginner ![]() Joined: 26 Apr 15 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Edited. I solved the problem. I type the coordinates incorrect.
Edited by Damir - 27 Apr 15 at 7:02PM |
|
![]() |
|
AndrewC ![]() Moderator Group ![]() ![]() Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
![]() ![]() ![]() ![]() ![]() |
Damir,
The ImageWidth and ImageHeight functions return the width and height of the image in pixels. To get the DPI of an image you need to use ImageHorizontalResolution and ImageVerticalResolution. With these values you can calculate the true width and height of the image if drawn at a 1:1 ratio. This is important because all of the Drawing functions are specified using the current measurement system set which could be points, mm or inches. Using the pixel width / height returned by ImageWidth / ImageHeight will result in possibly strange results. This is why you are forced to use w/2 and h/2 in order to get a smaller image. Here is the correct code to add and draw an image at a 1:1 ratio. http://www.quickpdf.org/forum/creating-a-multi-page-pdf-from-a-multipage-tiff_topic2125.html Andrew
|
|
![]() |
|
Damir ![]() Beginner ![]() Joined: 26 Apr 15 Status: Offline Points: 4 |
![]() ![]() ![]() ![]() ![]() |
Andrew, thank you for answering. I'll test "Image...Resolution" method in my code. I really have a trouble with "strange results", wich I get via "ImageWidth(Height)" method. Thank you for example too
|
|
![]() |
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