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 - Cannot Draw anything
  FAQ FAQ  Forum Search   Register Register  Login Login

Cannot Draw anything

 Post Reply Post Reply
Author
Message
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Topic: Cannot Draw anything
    Posted: 15 Feb 07 at 7:02PM
I just started with QuickPDF (thanks to Ingo) and some things I can do, some not. Using xHarbour+FWH
I can:
- Use the DLL handle and open it
- Open the existing PDF (test1.pdf)
- Add a new page to this PDF
- Write the new PDF (test2.pdf - which now is larger in bytes)

When I open this new page (test2.pdf) I see the newly added page. So far so good.

What I cannot
I cannot Draw any text on any page, including the newly created page!
The "code" is as follows:

LoadFromFile("test1.pdf")  // Has two pages!
r := Newpage()                  // now we have 3 pages
AddStandardFont(4)
SetTextSize(10)
SelectPage(r)
DrawText(100,500,"SOME TESTED TEXT")
SaveToFile("test2.pdf")      // test2.pdf now has 3 pages!

The text is not visible on the page number 3!
If I try to write any text to the page 2 or 1, the same problem. This is why I added a new page to check if maybe the existing content of the pages 1 and 2 are preventing me to see what is drawn.

The strange situation arises also if I do NOT add a new page and write the text onto page 1 or 2. The resulting test2.pdf is LONGER in bytes than test1.pdf, but I cannot see what I drowe! ?

I am probably doing wrong something but cannot find what. I desperately need help because if I cannot write onto the existing pages content, I cannot use this DLL. And it seams so promissing (one of the best things for programaticaly PDF handling I found by now)

Please help
Boris


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: 16 Feb 07 at 1:39AM
Hi Boris!

Please first try the samples from the original iSED-site:
http://isedquickpdf.com/?pg=kb
You unlocked the library?

Best regards,
Ingo

Back to Top
ukobsa View Drop Down
Senior Member
Senior Member


Joined: 29 May 06
Location: Germany
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote ukobsa Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 2:48AM
Boris,

which version of QuickPDF are you using? I have tested it on my system and here it works fine (ok, it was not the dll version but my source version).
Another idea: can you try to draw the text on position (50,50)? If it works fine then you should see the text on the lower left part of your page [Reason: if you have a small page (i.e. A5) then drawing on (100, 500) could draw it outside the page]

HTH,
Ulrich
Back to Top
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 6:59AM
Originally posted by Ingo Ingo wrote:

Hi Boris!

Please first try the samples from the original iSED-site:
http://isedquickpdf.com/?pg=kb
You unlocked the library?

Best regards,
Ingo


- My library version  reports: 5.11

- yes I unlocked the DLL, othervise it would not make another PDF and save it to disk.

yes, I followed one of the samples after loading the test1.PDF (100K long)
nSelected = SelectedDocument()
SetOrigin(1)
SetmeasurementUnits(1)
f1 = AddStandardFont(4)
f2 = AddStandardFont(5)
f3 = AddTrueTypeFont("Verdana",0)
SelectFont(f1)
SettextColor(1,0,0)
SettextSize(24)
Drawtext(15,15,"Some RED text from Boris")
SelectFont(f2)
SettextColor(0,0,1)
SettextSize(46)
Drawtext(105,50,"Some BLUE text from Boris")
RemoveDocument( nSelected )

Then I saved to a new test2.PDF which shows 102K long, meaning there IS some content, but is invisible?
Maybe bacause of LAYERS? Maybe my text was BEHIND the existing content?

I feel I am so close and so far at the same time :(

regards
Boris



Edited by Boris - 16 Feb 07 at 7:04AM
Better to write programs than not to write programs...
Back to Top
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 7:03AM
Originally posted by ukobsa ukobsa wrote:

Boris,

which version of QuickPDF are you using? I have tested it on my system and here it works fine (ok, it was not the dll version but my source version).
Another idea: can you try to draw the text on position (50,50)? If it works fine then you should see the text on the lower left part of your page [Reason: if you have a small page (i.e. A5) then drawing on (100, 500) could draw it outside the page]

HTH,
Ulrich

I am using 5.11 ( as reported from the function LibraryVersion() )

I tried to write on the positions 15,15 and also on 105,50
The same result.
The main problem is that the newly saved test2.PDF HAS some new content in comparation woth test1.PDF (the original) because is bigger size than original...

My original PDF page sizes are A4

Regards
Boris

Better to write programs than not to write programs...
Back to Top
ukobsa View Drop Down
Senior Member
Senior Member


Joined: 29 May 06
Location: Germany
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote ukobsa Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 7:19AM
Boris,

can you try it with version 5.14 or 5.21 (look for 'Library Downloads' section)?

And if this doesn't help, can you email the created PDF to support/at/quickpdf.org


best regards,
Ulrich
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: 16 Feb 07 at 7:54AM
Hi Boris!

Only for testing:
There're a lot of tools for textextraction...
Can you extract (and then see) your text from the document?

Best regards,
Ingo

Back to Top
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 8:36AM
Originally posted by ukobsa ukobsa wrote:

Boris,

can you try it with version 5.14 or 5.21 (look for 'Library Downloads' section)?

And if this doesn't help, can you email the created PDF to support/at/quickpdf.org


best regards,
Ulrich

I downloaded the 5.21 and have the same problem Confused
Better to write programs than not to write programs...
Back to Top
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 8:52AM
Originally posted by Ingo Ingo wrote:

Hi Boris!

Only for testing:
There're a lot of tools for textextraction...
Can you extract (and then see) your text from the document?

Best regards,
Ingo


Hi Ingo,

the situation is as follows:
1. The tutor1.PDF is used as the start file and is of length 10,852 and 1 page
2. When loded I select page 1 and write some text ono the first page
3. Then I add a new page so now we have 2 pages
4. I select the page 2 and write some text onto the page 2
5. I save the new file tutor2.PDF
6 I ExtractFilePages() from tutor2.PDF and write it into tutor3.PDF

7. I ExtractFilePageText() from the 1, page from tutor1.PDF and got all the text on that page, it is unchanged as original

8. I ExtractFilePageText() from the 1. page from tutor2.PDF and got all the text on that page. It should have my text written on this page, but it also show only the original text as in tutor1.PDF

9. I ExtractFilePageText() from the 2. page from tutor2.PDF and got nothing! It should show at least one string I wrote onto the second page I added. This second page is visible when open it with viewer, but is empty.

The lengths:
tutor1.PDF = 10,852
tutor2.PDF = 12,982  (created from tutor1 + text + new page)
tutor3.PDF = 12,715  (created from tutor2 only first page)

Files:
Tutor1.pdf the original, unchanged
Tutor2.pdf
(The changed with text on first page, a new page and text on it)

Any ideas?
Can you load tutor1.pdf, put some text on the first page, add a new page and put some text on second page, then tsave it to tutor2.pdf and see the text when viewing?

Thank you
Regards
Boris







Edited by Boris - 16 Feb 07 at 9:01AM
Better to write programs than not to write programs...
Back to Top
marian_pascalau View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 28 Mar 06
Location: Germany
Status: Offline
Points: 278
Post Options Post Options   Thanks (0) Thanks(0)   Quote marian_pascalau Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 9:35AM

For those who care here is a small VBS program to test the QuickPDF ActiveX capabilities.

Boris, this test was made specially for your problem. It shows that the PDF creation it works as expected. But of course I have never used the 5.11. Please register the latest ActiveX dll (5.21) and try again:

<Test cmd-file="test.bat">
cscript //nologo PDFTester.vbs
rem will generate file: testdrawtext.pdf
rem with 1 single page.

copy testdrawtext.pdf testdrawtext-2pages.pdf
cscript //nologo PDFTester.vbs testdrawtext-2pages.pdf
rem will modify testdrawtext-2pages.pdf
rem and add a second page.

open testdrawtext.pdf
rem must have 1 page with your text at 100,500

open testdrawtext-2pages.pdf
rem must have 2 pages, both with your text at 100,500

rem for a custom test run
cscript //nologo PDFTester.vbs test1.pdf
rem as result you should see your text appended to test1.pdf
rem document
</Test>

<Script filename="PDFTester.vbs">
option explicit
on error resume next
' The main proc
call main(WScript.Arguments)

' On error Quit with exit code 1
if Err.Number <> 0 then
 WScript.Echo "Error # " & CStr(Err.Number) & " " & Err.Description
 WScript.Quit(1)
end if

function main(args)
    dim iPDF
    set iPDF = CreateObject("iSED.QuickPDF2")

    if iPDF.UnlockKey("your quickpdf key") <> 1 then
        Err.Raise vbObjectError, , "Cannot unlock PDF library"
    end if

    if args.Count = 0 then
        call processPage(iPDF, 1, "testdrawtext.pdf")
    else
        dim i
        for i = 0 to args.Count - 1
            WScript.Echo "Process: " & args(i)
            if iPDF.LoadFromFile(args(i)) <> 1 then
                Err.Raise vbObjectError, , "Cannot load pdf document: " & args(i)
            end if

            dim ndoc, npage
            ndoc  = iPDF.SelectedDocument
            npage = iPDF.NewPage

            call processPage(iPDF, npage, args(i))
            call iPDF.RemoveDocument(ndoc)
        next
    end if

    set iPDF = Nothing
end function

function processPage(iPDF, npage, pdffile)

    call iPDF.AddStandardFont(4)
    call iPDF.SetTextSize(10)
    call iPDF.SelectPage(nPage)
    call iPDF.DrawText(100, 500, "SOME TESTED TEXT")

    call iPDF.SaveToFile(pdffile)

end function

</Script>

Back to Top
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 10:09AM
Marian,
Thanks for your time.

I am using 5.21 now
I never used this kind of apporach you suggest, so I don't know what to do with the script you sent :( Is this some text file I have to create?

Can you explain me please, where to load the script and how to run this test?

regards
Boris


Better to write programs than not to write programs...
Back to Top
Boris View Drop Down
Team Player
Team Player
Avatar

Joined: 15 Feb 07
Location: Belgrade Serbia
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote Boris Quote  Post ReplyReply Direct Link To This Post Posted: 16 Feb 07 at 8:11PM
Hey people, I solved it! :)
The main problem was the fact xHarbour does not use so stritly defined variable types. We basicaly have DOUBLE, INT, WORD and LONG
Whatever I put as the variable type in the finction DrawText() it didin't print anything!

Finaly I found that we can also use _DOUBLE variable type (11) and this did the whole trick! Now I can print wherever I want, save the changed PDF and have all the data written on the proper location pf PDF

If someone is working in xHarbour + Fivewin, I am here to help and explain and send the sample code. I really don't like the idea someone else should spent 2 days of a very hard work and hear pulling like me. :)

Now I can continue testing and working with xHarbour as before. Printing PDF as I need it.

Ingo, thanks again for helping with the demo key.
I am sure after a few days of testing I will buy this DLL retail key

regards to all,
it's time to get some rest. :)
Boris



Better to write programs than not to write programs...
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