Hi all,
My objective is quite simple, but I'm having trouble trying to find a sample code to work with. What I'm looking for is a mathod or methods to detect/determine if the document that is being passed to Amyuni driver is in PDF.
Why you ask?
My Users use a lot of applications (From MS Word to Adobe Acrobat and some other home grown apps) but what I'm trying to avoid is having a document that is in PDF already get "Re-rendered" by Amyuni. You know as much as I do that users want it as simple as possible so.. I'm looking for something that simply detects if the file is in PDF and if it is Amyuni can just leave it alone and pass it to the appropiate directory for the users to open in PDF reader.
Can someone provide some sample codes that would detect the header of the document? (You know, just like opening a PDF file in a Notepad and reading the header where it says PDF 1.3 or whatever)
Or what is the best way to detect if the file is in PDF?
truely appreciate your inputs
(note: sorry for the double post, I'm not sure where this thread should be under)
ramie
newbie question: How-to Detect if document is in PDF format?
-
- Posts: 60
- Joined: Mon Jul 28 2003
Re: newbie question: How-to Detect if document is in PDF for
The PDF standard requires that the file begin with '%PDF' (if you open a PDF in a text editor you'll see it). This is a very quick and dirty way of determining whether a file with a PDF extension is actually a PDF or not (it's a first cut filter - if you really want to detect, you'll need to actually read for the trailer and startxref tag and start parsing the PDF - but that's probably beyond what you are looking for.
For reference, you can read the PDF spec here: http://partners.adobe.com/public/develo ... rence.html
The section you are interested in is titled "File Header"
Cheers,
- K
For reference, you can read the PDF spec here: http://partners.adobe.com/public/develo ... rence.html
The section you are interested in is titled "File Header"
Cheers,
- K
RUNTIME wrote:Hi all,
My objective is quite simple, but I'm having trouble trying to find a sample code to work with. What I'm looking for is a mathod or methods to detect/determine if the document that is being passed to Amyuni driver is in PDF.
Why you ask?
My Users use a lot of applications (From MS Word to Adobe Acrobat and some other home grown apps) but what I'm trying to avoid is having a document that is in PDF already get "Re-rendered" by Amyuni. You know as much as I do that users want it as simple as possible so.. I'm looking for something that simply detects if the file is in PDF and if it is Amyuni can just leave it alone and pass it to the appropiate directory for the users to open in PDF reader.
Can someone provide some sample codes that would detect the header of the document? (You know, just like opening a PDF file in a Notepad and reading the header where it says PDF 1.3 or whatever)
Or what is the best way to detect if the file is in PDF?
truely appreciate your inputs
(note: sorry for the double post, I'm not sure where this thread should be under)
ramie
Sorry for the late reply...
Hi Joan,
sorry for the late reply... to answer your question:
Yes, we allow the user to open any application and print to Amyuni so how can we disallow users from trying to print from an application for ex: Acrobat whose files are already pdfs ?
I know this is probably too much to ask, but can you provide me with block diagram of how amyni interacts with the GDI until a PDF file is procuced... not asking for source code, just need a good understanding of the steps taken to produce a PDF...
For some reason, I always though that Amyuni takes the output of the a complete RAW print job/file from the Amyuni Print Queue and simply converts the file as if your doing a simply cmd line to a PDF and not via the GDI which tells it to create the PDF by drwaing lines and shapes and so on...
In any case, any relevant info is greatly appricated.
thanks,
ramie
sorry for the late reply... to answer your question:
Yes, we allow the user to open any application and print to Amyuni so how can we disallow users from trying to print from an application for ex: Acrobat whose files are already pdfs ?
I know this is probably too much to ask, but can you provide me with block diagram of how amyni interacts with the GDI until a PDF file is procuced... not asking for source code, just need a good understanding of the steps taken to produce a PDF...
For some reason, I always though that Amyuni takes the output of the a complete RAW print job/file from the Amyuni Print Queue and simply converts the file as if your doing a simply cmd line to a PDF and not via the GDI which tells it to create the PDF by drwaing lines and shapes and so on...
In any case, any relevant info is greatly appricated.
thanks,
ramie
There's unfortunately no way the PDF Converter can detect the source document type. This question comes back frequently and we've analyzed all possible solutions.
Please note that the developer license does not allow the general purpose conversion to PDF from any application installed on the end-user's system. This requires special licensing from Amyuni.
Please note that the developer license does not allow the general purpose conversion to PDF from any application installed on the end-user's system. This requires special licensing from Amyuni.