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!
LoadFromFile always fails |
Post Reply |
Author | |
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
Posted: 28 Nov 11 at 5:11AM |
I'm attempting this with the freeware QuickPDF library version 8.12. All I'm trying do is load an existing PDF, add some text, and save it. Unfortunately, I cannot open any existing PDF. The return code is always zero. The QuickPDF object I'm initiating is good, because I can create a new document from scratch (using QPL.NewDocument), add some text, then save it perfectly. It's just loading PDFs that won't work it seems. Here's what I'm doing (in PowerBASIC):
Is this somehow crippled in the freeware version of QuickPDF?
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Are you using PowerBasic 9 or 10 ?
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Can you specify the full path to the PDF as the current path may not be set to the location you expect.
If QPL.LoadFromFile("f:\users\fred\downloads\sample.pdf", "") = 0 Then Andrew.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
I am using PB 9.05 for this particular project.
As for PDF -- I've tried specifying the full path, but will try again. I've also tried opening 3 different PDFs now. The most current one I'm attempting to load is an empty single-page PDF created in LibreOffice Writer (via File -> Export to PDF). It *should* be a valid PDF.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Ok, I've now tried 5 different PDFs (all from different sources), so I don't think it's the PDF file(s) at fault. I have tried with the full path, and without the full path. All my PDF viewers/editors can read these 5 PDFs fine too.
I really wish "LastErrorCode" was available in the free version!
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi!
Here you'll find a sample for PowerBasic, too:
Perhaps you can adapt the syntax for the free version...
And in case the free version doesn't offer enough for your needs:
Why not use the full test-version (with a testkey) for 30 days for evaluation?
Cheers, Ingo Edited by Ingo - 29 Nov 11 at 7:15AM |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
We will be adding LastErrorCode to the next Lite version.
I will see if I can do some testing tomorrow to see what could be going on. Andrew.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Thanks Andrew, I'd appreciate that! Good news about adding LastErrorCode too. Ingo: I only need to add text to an existing PDF, so the commercial version is overkill at the moment. I may still install the trial and give that a shot if I cannot get this issue dealt with soon.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
The following C# program is running correctly with the QPL Lite I downloaded from the web page.
1. I installed QPL Lite. 2. CD "\program files (x86)\Quick PDF Library\Lite" 3. regsvr32 QuickPDFLite0812.dll 4 I started up VS 2010 and here is the code. 5. Add a Reference to the QuickPDFLite812.cs file to your project - It can be found in \Quick PDF Library\Lite\Import\CSharp LoadFromFile is returning 1 and the save PDF is opening up perfectly. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using QuickPDFLite0812; namespace QPL_Lite { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { PDFLibrary QP = new PDFLibrary(); Directory.SetCurrentDirectory("f:\\users\\me\\downloads"); int ret = QP.LoadFromFile("timeslot.pdf", ""); QP.SaveToFile("out.pdf"); System.Diagnostics.Process.Start("out.pdf"); } } } Edited by AndrewC - 01 Dec 11 at 8:37AM |
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
I've never used C#, but I downloaded and installed Visual C# 2010 Express to give your code a try. I also unregistered and re-registered QuickPDFLite0812.dll successfully (using an administrative rights command prompt). Opened up VS 2010 Express, created a new "Windows Forms Application" project, added a button called "button1", and pasted your code verbatim to the code view. Ran the project, and it stopped with the following error: The type or namespace name 'QuickPDFLite0812' could not be found (are you missing a using directive or an assembly reference?) I'm certain QuickPDFLite0812.dll is registered properly, since in PowerBASIC I can create a PDF from scratch fine. I just can't load one and alter it.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
You need to add the QuickPDFLite812.cs file to the project.
It can be found in Quick PDF Library\Lite\Import\CSharp - QuickPDFLite812.cs In Solution Explorer in the right, right click on your project name (top item in the treelist) and then choose, Add, then Existing Item. It should then compile.
|
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Can you send us a link to one of your PDF files. I can check to see if the file is loading correctly on my system.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Andrew -- below are links for two different PDFs I've tried: |
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Guy guys -- just wondering if you had a chance to check into this any further.
In the meantime, is there a different Lite version I can download and try? The download.com link for version 7.25 on your Freeware page actually goes to version 8. Thanks!
Edited by ibeleaf - 13 Dec 11 at 4:56AM |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
The files are loading properly into QPL 8.xx.
Have you managed to get the C# project running ? Version 8 was a major change to using Unicode strings internally but we have PowerBasic customers using the v8.xx library without problems. Have you tried the 30 day trial evaluation version ? I will see if I can find a link to the 7.25 Lite Version that you can download. Andrew.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Sorry, I completely forgot to follow up on the C# test. I just tried again... and it worked!
This must be a PowerBASIC issue then... let me check that code again and see if anything stands out.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
I'm still trying a few tests here, but nothing successful yet. Not sure if this helps -- but here's a link to the PowerBASIC include file I generated (using QuickPDFLite0812.dll): |
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Stop the presses..... success!!!
I went back and read over this entire thread, and noticed you mentioned unicode was introduced in version 8. I neglected to recall that in PowerBASIC, you need to explicitly use the UCODE$ function on a string in order to pass it as unicode. So I passed the filename argument to LoadFromFile() using UCODE$, and it worked!! I'm going to do some more tests, but it's looking good. I'll report back shortly with final confirmation...
Edited by ibeleaf - 14 Dec 11 at 3:07PM |
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Well I have confirmed it was a missing UCODE$ call. Thanks for the attention guys, definitely appreciated!
As a reference, for those of you using PowerBASIC -- be sure to UCODE$ the filename argument when passing it to LoadFromFile()!
Edited by ibeleaf - 15 Dec 11 at 4:33AM |
|
AndrewC
Moderator Group Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
|
Just to confirm - was it the UCODE$ or the UCASE$ function that fixed the problem or does it require both functions. Andrew.
|
|
ibeleaf
Beginner Joined: 28 Nov 11 Location: Canada Status: Offline Points: 17 |
Post Options
Thanks(0)
|
Whoops, sorry -- UCODE$ is the solution. I've corrected my earlier post to reflect this.
Thanks again guys!
|
|
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