Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC8.0 PDF
Hi,
 
I need to convert encrypted pdf->text with the password given by the user.
 
IN C++
 
I am able to open(unencrypted) pdf by using VC++ using zlib.
I am opening pdf in 'rb' mode
 
Do I need to write a custom function to decrypt stream by the given password ?
 
[STATUS: code working for unencrypted PDF ]
 

IN JAVA
 
I have found code in java which do PDF to Text extraction by using PDFBox-0.7.3, but have some issues with the code.
There is a null pointer exception at PDFBox-0.7.3\src\org\pdfbox\ExtractText.java
 
 AccessPermission ap = document.getCurrentAccessPermission();  
 
if (!ap.canExtractContent())
 

http://www.apache.org/dist/pdfbox/1.5.0/pdfbox-1.5.0-src.zip[^]
 

[STATUS: code just creates empty file ]
 

Am I doing extraction of the pdf in wrong way ?
What can be the correct steps to decrypt PDF ?
Posted 22-Mar-11 20:19pm
01.mandar1.2K
Edited 24-Mar-11 4:36am
v4
Comments
Richard MacCutchan at 23-Mar-11 5:05am
   
So what is your problem? Have you checked the zlib documentation?
01.mandar at 24-Mar-11 8:53am
   
user inputs are pdf path ,password ,txt file
i need to decrypt pdf by user password
how to decrypt stream ?
will inflate() versions be useful
 
is above possible to do in zilb?
Richard MacCutchan at 24-Mar-11 11:40am
   
I think you may be looking at this from the wrong point of view. You need to find a library that can handle encrypted PDF files. I am not certain, but I do not think you can just read it as a stream and pass it through a decryption process.
HimanshuJoshi at 23-Mar-11 15:46pm
   
Edited to remove unnecessary bold tag.
Dalek Dave at 24-Mar-11 9:37am
   
Edited for Grammar and Readability.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You either:
 
(the fast route)
  • Use a library (free or commercial). As already suggested, Google would help you finding it
 
or
 
(the 'scenic' route)
  • Study the PDF specifications (freely available) and write your own code to do the job.
  Permalink  
Comments
01.mandar at 24-Mar-11 9:02am
   
i have seen 2 library
zlib in c++
Pdfbox in java
coding for both mostly work on unencrypted pdf
my difficult is the pdf encryption
it just creates blank txt file when encrypted pdf is passed
Dalek Dave at 24-Mar-11 9:38am
   
Good Call.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It sounds like what you need is an SDK that has APIs to allow you to open and extract text from a PDF file. I'm sure you will find lots by googling 'PDF SDK'.
  Permalink  
Comments
01.mandar at 24-Mar-11 9:08am
   
i have seen some pdf sdk but they are mostly in .NET or for trial/demo basis
i will continue looking more for c++ or java

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 230
2 BillWoodruff 205
3 DamithSL 165
4 Sergey Alexandrovich Kryukov 155
0 OriginalGriff 5,130
1 DamithSL 4,157
2 Maciej Los 3,650
3 Kornfeld Eliyahu Peter 3,460
4 Sergey Alexandrovich Kryukov 2,811


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 24 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100