Print Page | Close Window

Insert Lines In PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1064
Printed Date: 25 Jun 25 at 5:55PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Insert Lines In PDF
Posted By: Danish_k12
Subject: Insert Lines In PDF
Date Posted: 18 Apr 09 at 5:10AM
I work in a Company which deals in Variable Data Printing (VDP). We recieve file in various format. I am currently working as a Sr.Software Engineer and have do deal with file manipulation.
I have done file manipulation in text format, html format, etc.
The only format i have been unsuccessful is PDF format.
Recently i posted a article about this in Dani Web as mostly i programmed using Vb6 (Think pretty good in it).
And got link to quick PDF.
Well I think it would do most of my job.
I need to sort PDF file on basis of their pincode, Insert OMR LINE etc.
Well I started with Inserting OMR LINE in vb6.
Sample Code:

Set qp = CreateObject("QuickPDFAX0712.PDFLibrary")
Call qp.UnlockKey("Licence Key")
qp.LoadFromFile ("c:\test.pdf")

a = qp.DAOpenFile("c:\test.pdf", "")
pagecount = qp.pagecount
For i = 1 To pagecount
    b = qp.DAFindPage(a, i)
    liner = qp.DAExtractPageText(a, b, 0)
    qp.SelectPage (i)
    If InStr(1, liner, "Page No 1") > 0 Then
        Call qp.DrawLine(10, 750, 100, 750)
        Call qp.DrawLine(10, 700, 100, 700)
    Else
        Call qp.DrawLine(10, 700, 100, 700)
    End If
Next i

(For those who are not familiar with VDP I'll Explain wat i m trying to do here I have to insert two lines on 1st page of all statement and one line on remaining pages of that statement )

It is working fine for me the problem is it gives error after 117 page approx. Out Of Memory Dead

Please Help. What should i do?????
Where am i gng wrong.????

Regards,
Danish Khan




Replies:
Posted By: DELBEKE
Date Posted: 18 Apr 09 at 5:34AM
You shoul avoid mixing direct acces function (those begining whit the DA prefix) with standards ones.
 
here is a sample of what you should do
Private Sub Command1_Click()
Dim Qp As QuickPDFAX0712.PDFLibrary
Dim I As Long
Dim PageCount As Long
Dim Liner As String
Dim DocId As Long
Set Qp = CreateObject("QuickPDFAX0712.PDFLibrary")
Call Qp.UnlockKey("my key")
Qp.LoadFromFile ("c:\test.pdf")
DocId = Qp.GetDocumentID(1)
PageCount = Qp.PageCount
For I = 1 To PageCount
  Qp.SelectPage I
  Liner = Qp.GetPageText(0)
  If InStr(1, Liner, "Page No 1") > 0 Then
      Call Qp.DrawLine(10, 750, 100, 750)
      Call Qp.DrawLine(10, 700, 100, 700)
  Else
      Call Qp.DrawLine(10, 700, 100, 700)
  End If
Next I
Qp.SaveToFile "c:\test_omr.pdf')"
Qp.RemoveDocument DocId
End Sub


Posted By: Danish_k12
Date Posted: 18 Apr 09 at 6:57AM
Thank you for your quick reply the code is now working without error.
But there is a major issue we have to always work on may files (400 to 500) each  being nearly 20,000 pages.
The above code is taking 1 sec for 2 pages which is quite slow it will take a large amount of time for me to process it.
One thing i have notice is the speed is reducing as the number of pages increase like for suppose first 1000 page it took me 10 min next thousand page it has taken me 15 min and so on....



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk