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!
![]() |
VBscript .LoadFromFile do nothing |
Post Reply ![]() |
Author | |
Thierry_B ![]() Beginner ![]() Joined: 23 May 21 Status: Offline Points: 9 |
![]() ![]() ![]() ![]() ![]() Posted: 23 May 21 at 11:24AM |
Hello, Sorry for bad enghish, I'm French I try to load un PDF file with Lite Library but always receive 0 result (file not loaded). I tried with full path and without, with differents files. Always same result. Any ideas ? Thanks Thierry ' Debenu Quick PDF Library Lite Sample WScript.Echo("Debenu Quick PDF Library Lite - Hello World Sample") Dim ClassName Dim QP Dim InFileName Dim OutFileName Dim lWidth Dim lHeight ClassName = "DebenuPDFLibrary64Lite1114.PDFLibrary" InFileName = "image.png" OutFileName = "Testfini.pdf" Set QP = CreateObject(ClassName) ' Load the PDF that you want to add the image to if (QP.LoadFromFile("testPDF", "")) = 0 Then WScript.Echo("Erreur chargement PDF") ' Load the image that you'd like to convert to PDF Call QP.AddImageFromFile(InFileName, 0) ' Get the width and height of the image lWidth = QP.ImageWidth() lHeight = QP.ImageHeight() ' Reformat the size of the page in the selected document Call QP.SetPageDimensions(lWidth, lHeight) ' Draw the image onto the page using the specified width/height Call QP.DrawImage(0, lHeight, lWidth, lHeight) ' Save the new PDF to disk If QP.SaveToFile(OutFileName) = 1 Then WScript.Echo("File " + OutFileName + " written successfully") Else WScript.Echo("Error, file could not be written") End If Set QP = Nothing WScript.Sleep(9000)
|
|
![]() |
|
Sopracenery ![]() Team Player ![]() ![]() Joined: 31 Aug 20 Location: Germany Status: Offline Points: 29 |
![]() ![]() ![]() ![]() ![]() |
Hi Thierry,
Please check first your filename. testPDF looks not like a PDF file. Try test.PDF and then read out WScript.Echo(QP.LastErrorCode) It returns 0 with „testPDF“ and it returns 401 with „test.PDF“ when File Not Found. Edited by Sopracenery - 24 May 21 at 8:26AM |
|
![]() |
|
Thierry_B ![]() Beginner ![]() Joined: 23 May 21 Status: Offline Points: 9 |
![]() ![]() ![]() ![]() ![]() |
Thanks :-)
|
|
![]() |
|
Thierry_B ![]() Beginner ![]() Joined: 23 May 21 Status: Offline Points: 9 |
![]() ![]() ![]() ![]() ![]() |
Ok, omit ".pdf" in my example.
Here is the function called by hMailServer (EventHandlers): Function ImageToPDF(FileName, ExtFileName, SaveFolder) ' Converti les images en PDF ' JPG/JPEG/TIFF/TIF EPS à tester? ' Retourne True si Ok ' Retourne False si erreur Dim ClassName Dim QP Dim OutFileName Dim lWidth Dim lHeight ClassName = "DebenuPDFLibraryLite1114.PDFLibrary" Set QP = CreateObject(ClassName) ImageToPDF = False ' Load the image that you'd like to convert to PDF If (QP.AddImageFromFile(FileName, 0)) = 1 Then ' Get the width and height of the image lWidth = QP.ImageWidth() lHeight = QP.ImageHeight() ' Reformat the size of the page in the selected document Call QP.SetPageDimensions(lWidth, lHeight) ' Draw the image onto the page using the specified width/height Call QP.DrawImage(0, lHeight, lWidth, lHeight) ' Save the new PDF to disk OutFileName = SaveFolder & GetBaseFile(FileName) & "." & "pdf" Call QP.SaveToFile(OutFileName) ImageToPDF = True End If Set QP = Nothing End Function AddImageFromFile don't load file and retour code error is 0 File name is correct : "C:\MailServerAttachements\XXXXX@XXXX.cc\2021\20210524100511001info@XXXX.be.image.jpg Any idea ? |
|
![]() |
|
Thierry_B ![]() Beginner ![]() Joined: 23 May 21 Status: Offline Points: 9 |
![]() ![]() ![]() ![]() ![]() |
Ok it seems running.
I changed main folder (p:\...) to C:\... P folder is a "space storage" on Windows Server 2012 Thanks for helping
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Thierry,
the function LastErrorCode always returns with a more detailed error code from the last called function... https://www.debenu.com/docs/pdf_library_reference/LastErrorCode.php directly after Load... should have return with error code 401 or 408 and then you would have known ;-) Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
![]() |
|
Thierry_B ![]() Beginner ![]() Joined: 23 May 21 Status: Offline Points: 9 |
![]() ![]() ![]() ![]() ![]() |
Thanks
|
|
![]() |
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