» Archive for July, 2007

Mars is an XML-friendly representation for PDF documents

Friday, July 27th, 2007 by rubypdf

The Mars (code name) Project is an XML-friendly representation for PDF documents. Already an open specification, PDF is the global standard for trusted, high fidelity electronic documentation. The Mars file format incorporates additional industry standards such as SVG, PNG, JPG, JPG2000, OpenType, Xpath and XML into ZIP-based document container. The Mars plug-ins enable creation and recognition of the Mars file format by Adobe Acrobat 8.1 Professional and reading of Mars-format files by Adobe Reader 8.1 software.

There are many exciting use cases where the XML friendly Mars file format makes the construction of applications much easier by:

  • Creating documents from databases or other enterprise applications.
  • Assembling documents from components.
  • Merging documents including structure, pages, and navigation.
  • Extracting document information such as comments, structure, content, and images.
  • Adding document navigation, interactive behavior, multimedia, and 3D content to increase document value.
  • Decomposing documents into parts for storage in libraries, databases, or content management systems.
  • Validating document representation, content, and structure.
  • Creating and processing forms.
  • Packaging sets of documents and coordinating their presentation and operation.

Update: Mars beta 2 was released on June 25, 2007. Get it now.

From:Adobe Labs - Mars Project

Using the iTextSharp library in Delphi .NET

Thursday, July 19th, 2007 by rubypdf

from http://www.noliturbare.com/iTextDelphi.php


This example, taken from from the iText tutorial,
demonstrates how easy the iTextSharp library can be used in Delphi .NET,
using the free (!) Explorer Edition of Turbo Delphi .NET, to create or manipulate PDF’s.
Note that there is also a difference between the original example and the Delpi one:
this C# example is a command line application and the Delphi application is a Windows application.
When run, this simple application creates a PDF file containing just the text “Hello World”.


C# Hello World example


using System;
using System.IO;
using iTextSharp.text;

using iTextSharp.text.pdf;

namespace iTextSharp.tutorial.Chap01
{
public class Chap0101
{
public Chap0101()
{
Console.WriteLine("Chapter 1 example 1: Hello World");
// step 1: creation of a document-object
Document document = new Document();
try
{
// step 2:-->

// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.GetInstance(document, new FileStream("Chap0101.pdf", FileMode.Create));
// step 3: we open the document
document.Open();
// step 4: we Add a paragraph to the document
document.Add(new Paragraph("Hello World"));
}
catch(DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch(IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}
// step 5: we close the document

document.Close();
}
}
}

Turbo Delphi .NET Hello World example


{Create a new VCL Forms Application. Add a reference to the iTextSharp.dll. Add a button to the form and apply the following code to the button's onclick event}

uses
Windows, Messages, SysUtils, ...., iTextSharp.text, iTextSharp.text.pdf;
....
....

procedure TForm1.Button1Click(Sender: TObject);
var
MyDoc : iTextSharp.text.Document;
Writer : iTextSharp.text.pdf.PdfWriter;
begin
// step 1: creation of a document-object
MyDoc := Document.Create;
try
// step 2: we create a writer that listens to the
// document and directs a PDF-stream to a file

Writer := PdfWriter.GetInstance(MyDoc, TFileStream.Create('C:\Chap0101.pdf', fmCreate));
// step 3: we open the document
MyDoc.Open();
// step 4: we Add a paragraph to the document
MyDoc.Add(Paragraph.Create('Hello World'));
except
ShowMessage('Oops... exception');
end;
// step 5: we close the document

MyDoc.Close();
end;

{Note that the file "Chap0101.pdf" is written to the root of the C: disk; change this as you like}

让Pdftk 支持中日韩路径

Thursday, July 19th, 2007 by rubypdf

Pdftk是一个简单的、命令行的PDF编辑软件,可以合并/分割PDF文档、解开必要的输入密码、输出加密、给PDF文档加水印、从PDF文档中解出附件、将PDF文档变成一页等等,能够做到编辑PDF文档的所有事情。

不了解Pdftk的朋友可以到下面的相关资源里找找答案,这里就不费口舌了。

Pdftk 是非常好用,但不支持中日韩路径,这点让我们很多中国朋友很头疼(虽然有变通的解决办法)。
现在喜欢Pdftk的朋友不用急了,我这里提供了可支持中日韩路径的修改版本,包括了修改后的源代码和Windows 程序(4.08M).

相关资源: