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 - LoadFromFile always fails
  FAQ FAQ  Forum Search   Register Register  Login Login

LoadFromFile always fails

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


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Topic: LoadFromFile always fails
    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):

' Variable "QPL" is initiated successfully earlier in the code...

If QPL.LoadFromFile("sample.pdf", "") = 0 Then
    MsgBox "ERROR: File could not be opened."
Else
    ' - add some text
    ' - save edited file
End If

Is this somehow crippled in the freeware version of QuickPDF?
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 11 at 12:27PM
Are you using PowerBasic 9 or 10 ?
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 11 at 12:49PM
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.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 28 Nov 11 at 2:38PM
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.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 29 Nov 11 at 4:14AM
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!
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 29 Nov 11 at 7:13AM
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
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 29 Nov 11 at 1:40PM
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.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 30 Nov 11 at 2:02AM
Originally posted by AndrewC AndrewC wrote:

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.


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.
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 30 Nov 11 at 12:59PM
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
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 01 Dec 11 at 4:43AM
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.
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 01 Dec 11 at 8:31AM
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.
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 01 Dec 11 at 8:32AM
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.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 01 Dec 11 at 6:37PM
Andrew -- below are links for two different PDFs I've tried:

http://dl.dropbox.com/u/38719496/blank.pdf
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 12 Dec 11 at 7:22PM
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
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 13 Dec 11 at 6:36AM
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.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 13 Dec 11 at 12:49PM
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.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 11 at 2:27PM
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):

http://dl.dropbox.com/u/38719496/QuickPDFLite0812.inc

Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 11 at 3:00PM
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
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 14 Dec 11 at 5:34PM
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
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 (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 15 Dec 11 at 2:45AM
Just to confirm  -  was it the UCODE$ or the UCASE$ function that fixed the problem or does it require both functions.

Andrew.
Back to Top
ibeleaf View Drop Down
Beginner
Beginner


Joined: 28 Nov 11
Location: Canada
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote ibeleaf Quote  Post ReplyReply Direct Link To This Post Posted: 15 Dec 11 at 4:34AM
Whoops, sorry -- UCODE$ is the solution.  I've corrected my earlier post to reflect this.

Thanks again guys!
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