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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Image doesn't add for each pdf-file
  FAQ FAQ  Forum Search   Register Register  Login Login

Image doesn't add for each pdf-file

 Post Reply Post Reply
Author
Message
Damir View Drop Down
Beginner
Beginner


Joined: 26 Apr 15
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damir Quote  Post ReplyReply Direct Link To This Post Topic: Image doesn't add for each pdf-file
    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
Back to Top
erico View Drop Down
Senior Member
Senior Member
Avatar

Joined: 24 Sep 14
Location: Minnesota USA
Status: Offline
Points: 51
Post Options Post Options   Thanks (0) Thanks(0)   Quote erico Quote  Post ReplyReply Direct Link To This Post Posted: 27 Apr 15 at 6:25PM
You may want to edit your post and remove your license key.
Eric O
Back to Top
Damir View Drop Down
Beginner
Beginner


Joined: 26 Apr 15
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damir Quote  Post ReplyReply Direct Link To This Post Posted: 27 Apr 15 at 6:55PM
Edited. I solved the problem. I type the coordinates incorrect.

Edited by Damir - 27 Apr 15 at 7:02PM
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (1) Thanks(1)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 15 at 8:18AM
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
Back to Top
Damir View Drop Down
Beginner
Beginner


Joined: 26 Apr 15
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Damir Quote  Post ReplyReply Direct Link To This Post Posted: 06 May 15 at 8:30AM
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store