Archive for November, 2009

Convert RTF to PDF with Open Source library iText

Version 2.1 of iText has partial support for reading an RTF file and converting it to a PDF. This feature is still under development.

and here is the example on how to parser and convert RTF to PDF(from http://cfsearching.blogspot.com/2009/04/itext-preview-of-things-to-come-someday.html)

import com.lowagie.text.Document;

import com.lowagie.text.DocumentException;

import com.lowagie.text.pdf.PdfWriter;

import com.lowagie.text.rtf.parser.RtfParser;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

public class ConvertRTFToPDF {


public static void main(String[] args) {

 String inputFile = "sample.rtf";

 String outputFile = "sample_converted.pdf";

 // create a new document

 Document document = new Document();

 try {

     // create a PDF writer to save the new document to disk

     PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile));

     // open the document for modifications

     document.open();

     // create a new parser to load the RTF file

     RtfParser parser = new RtfParser(null);

     // read the rtf file into a compatible document

     parser.convertRtfDocument(new FileInputStream(inputFile), document);

     // save the pdf to disk

     document.close();

     System.out.println("Finished");

 } catch (DocumentException e) {

     e.printStackTrace();

 } catch (FileNotFoundException e) {

     e.printStackTrace();

 } catch (IOException e) {

     e.printStackTrace();

 }

}

}

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride

Convert PDF to DXF with Free Open Source Software pstoedit and Ghostscript

pstoedit+ghostscript
1.download the last version pstoedit and ghostscript
2.install pstoedit and ghostscript
3 run command pstoedit -f dxf in.pdf out.dxf(make sure pstoedit can find the path of gswin32c.exe)

pstoedit+gsview
1.download the last version pstoedit and gsview
2.install pstoedit and gsview
3. use pstoedit as a plugin of gsview

pstoedit is a tool converting PostScript and PDF files into various other formats suported by different drawing editors. As a prerequesite it needs GhostScript to be installed (binary installation is sufficient).

Currently pstoedit can generate the following major formats:

  • Tgif .obj format (for tgif version >= 3)
  • .fig format for xfig
  • pdf – Adobe’s Portable Document Format
  • gnuplot format
  • Flattened PostScript (with or without Bezier curves)
  • DXF – CAD exchange format
  • LWO – LightWave 3D
  • RIB – RenderMan
  • RPL – Real3D
  • Java 1 or Java 2 applet
  • Idraw format (in fact a special form of EPS that idraw can read)
  • Tcl/Tk
  • HPGL
  • AI (Adobe Illustrator) (based on ps2ai.ps – not a real
    pstoedit driver – see notes below and manual)
  • Windows Meta Files (WMF) (Windows  only)
  • Enhanced Windows Meta Files (EMF) (Windows, but also Linux/Unix if
    libemf is available)
  • OS/2 meta files (OS/2 only)
  • PIC format for troff/groff
  • MetaPost format for usage with TeX/LaTeX
  • LaTeX2e picture
  • Kontour
  • GNU Metafile (plotutils / libplot)
  • Skencil ( http://www.skencil.org)
  • Mathematica
  • via ImageMagick to any format supported by ImageMagick
  • SWF
  • CNC G code
  • VTK files for ParaView and similar visualization tools

From above cheat, we know pstoedit supports generate DXF, but it needs the help of Ghostscript or GsView

Ghostscript is the name of a set of software that provides:
* An interpreter for the PostScript (TM) language and the Adobe Portable Document Format (PDF — sometimes confused with Acrobat, Adobe’s PDF browser/editor product), and
* A set of C procedures (the Ghostscript library) that implement the graphics and filtering (data compression / decompression / conversion) capabilities that appear as primitive operations in the PostScript language and in PDF.

reference,
GPL Ghostscript
GSview
pstoedit

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride

Crack PDF with Certificate Encryption

A friend gave me a PDF document with Certificate encryption, he bought from a vendor. The PDF even does not allow copy text, so he wanted me to crack it. After effort, I removed the encryption. And I also developed a software to do this kind job without need Adobe Acrobat, but I am not sure if it is legal or not, so I can not release it until I know it is legal.

BTW, Digital Signature vs (Certificate) Encryption
A digital signature can guarantee the integrity of the message and the identity of its sender. Encryption can prevent someone from being able to read an intercepted message.

Update: just noticed that LiveCycle Workbench ES has the feature, Remove PDF Certificate Encryption

Returns an unsecured PDF document when given a PDF document encrypted with a certificate. After certificate encryption security is removed from a PDF document, it is no longer secure.

Reference,
Remove PDF Certificate Encryption

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • DZone
  • ThisNext
  • MisterWong
  • Wists
  • BlinkList
  • blogmarks
  • blogtercimlap
  • connotea
  • DotNetKicks
  • Fark
  • Fleck
  • Gwar
  • Haohao
  • IndianPad
  • Internetmedia
  • LinkaGoGo
  • MyShare
  • Netscape
  • NewsVine
  • Rec6
  • Reddit
  • Scoopeo
  • Slashdot
  • StumbleUpon
  • Technorati
  • Webride