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 - lexicographic sorting issue
  FAQ FAQ  Forum Search   Register Register  Login Login

lexicographic sorting issue

 Post Reply Post Reply
Author
Message
puneethcm View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Feb 15
Location: India
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote puneethcm Quote  Post ReplyReply Direct Link To This Post Topic: lexicographic sorting issue
    Posted: 08 Feb 15 at 3:49PM
hi i have a question regarding quick pdf conversion. In my application we covert two or more pdf files (which each pdf page is alphanumeric) am trying to  convert all this pdf files into one pdf file but the order of the pages is sorting in lexicographic order(like  1,10, 11,12,13.....2,20,21,.....and so on).may i know the solution for this issue. the application converts each pdf page to .emf file and from .emf to final pdf file(which is combination of all pdf pages of pdf files) .....

May i know why the the issue is arising and solution for the problem...

Thanks in advance....Smile


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: 09 Feb 15 at 9:34AM
Hello,

This sounds more like a coding problem than a Debenu Quick PDF Libary file.  Files in an operating system are sorted on an ASCII sort.  If you want page numbers sorted numerically then you will need to load the filenames into a custom sort algorithm that sorts the files numerically.

If you post some code as to how you load each file then we may be able to help you.

Andrew.
Back to Top
puneethcm View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Feb 15
Location: India
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote puneethcm Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 15 at 3:29AM
Thanks andrew for the reply...

We use VB for scripting...
Set qp = reportobject("QPDF.QuickPDF")
Qp.renderdocumenttofile picture quality,   1, inumpage, 3 , docpath + "\" + zero + picturequality.emf

Here QP.renderdocumenttofile converts the PDF pages to .emf and .emf to final single PDF file which has sorting issues....

Inumpages is total number of PDF files
Docpath is temporary folder where the .emf images are created.

Zero is a variable where zeros are appended to solve some issue.
The file name of images are pucturequality1, picturequality so on.... can't we access these image file individually?? I tried but dint find the solution...
Back to Top
erico View Drop Down
Senior Member
Senior Member
Avatar

Joined: 24 Sep 14
Location: Minnesota USA
Status: Offline
Points: 51
Post Options Post Options   Thanks (0) Thanks(0)   Quote erico Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 15 at 3:35PM
Format you page numbers with leading zeros, as in

01, 02, 03 . . . 10, 11, . . . 20

Use as many leading zeroes as necessary. (001 . . . 999) (0001 . . . 9999) etc.
Eric O
Back to Top
puneethcm View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Feb 15
Location: India
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote puneethcm Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 15 at 3:54PM
The thing is it generates .emf file name as picturequality1, picturrqualit2, .....picturequality10.....we can't access the .emf file and modify the name...

Back to Top
erico View Drop Down
Senior Member
Senior Member
Avatar

Joined: 24 Sep 14
Location: Minnesota USA
Status: Offline
Points: 51
Post Options Post Options   Thanks (0) Thanks(0)   Quote erico Quote  Post ReplyReply Direct Link To This Post Posted: 10 Feb 15 at 4:03PM
'it' generates emf file names --  what is 'it'? Perhaps you can take the files from 'it' and rename them before feeding them to Debenu.

Or if 'it' is an application under your control, you can modify the behavior to name the files differently
Eric O
Back to Top
puneethcm View Drop Down
Beginner
Beginner
Avatar

Joined: 08 Feb 15
Location: India
Status: Offline
Points: 5
Post Options Post Options   Thanks (0) Thanks(0)   Quote puneethcm Quote  Post ReplyReply Direct Link To This Post Posted: 25 Feb 15 at 3:24AM
Application is not under our control and we can't access these .emf files and rename it..emf file is image of PDF pages...
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 26 Feb 15 at 12:48PM
Why are you using temporary EMF files at all?  If the objective is, as you say, to merge multiple PDF documents into a single PDF, go to the scripts section in the Library Dashboard, then Document Manipulation, then Merge a List of PDFs, and look at the example there.  This will add the documents to the merged file in the order that you specify them.

Having said that, it seems that RenderDocumenttofile has a design flaw.  It knows in advance how many pages will be output, so it should really provide at least an option to use a variant of %p to add the correct number of leading zeros to the filenames.
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: 06 May 15 at 10:23AM
puneethcm,

Instead of using RenderDocumentToFile you will need to use add your own loop and call RenderPageToFile instead.  This will allow you to control the filename for each page and to add leading zeros.

' -------------------------------------------------------------------------------------------------------------------------

Set qp = reportobject("QPDF.QuickPDF")

QP.LoadFromFile("input.pdf", "");
lNumPages = QP.PageCount();

for page = 1 tp lNumpages
begin

  ' Here you need to create a unique filename for each page with leading zero's.

  filename = docpath + "\" + picturequality + String.Format("{0:0000}", page)   '  Visual Basic - Google Search for 'VBScript leading zeros' if you need VBScript

  QP.RenderPageToFile(dpi, page, 3, filename);

end;
QP.RemoveDocument(QP.SelectedDocument())

' --------------------------------------------------------------------------------------------------------------------------

Andrew
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