By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,171 Members | 1,390 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,171 IT Pros & Developers. It's quick & easy.

Setting the version of a PDF file using Crystal Reports and/or C#.

P: n/a
I've been looking on the web trying to find a solution to converting a
PDF Form from v.1.6(Acrobat 7) to PDF v1.4(Acrobat 5). It's one of
those weird situations where one of the applications I'm using requires
v.1.4. v.1.6 will mess up the application itself. PDFversion.exe (a
conversion utility) doesn't support the 1.6 format and Acrobat 7
doesn't want to do backwards conversion on a PDF Form (at least from
what I can see).

So... I figure I have 2 options: 1.) recreate the form using Acrobat
5, or 2.)use some of my knowledge of C# and crystal reports to create a
little database and generate form output using the Crystal Reports
engine built into Visual Studio 2005. The form way is probably
quicker... but I like programming, so option 2 sounds like more fun :)

My problem is that the PDFs that I'm creating via C#+Crystal Reports,
are version 1.3 (I can't win, lol). However, I did find some nifty
Java code that allows the version of a PDF to be controlled
programmatically. Does anyone know if theres a command/switch/etc...
that would allow me to define the version of the PDF I'm outputting
when I do:
someRPT.ExportToDisk(CrystalDecisions.Shared.Expor tFormatType.PortableDocFormat,"SomeFile.pdf");

For the Java code I found the following stuff:

// setting a PDF to version 1.3, 1.4, 1.5, or 1.6
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class PdfVersion1_3 {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("PDFversion1_3.pdf"));
writer.setPdfVersion(PdfWriter.VERSION_1_3);
//writer.setPdfVersion(PdfWriter.VERSION_1_4);
//writer.setPdfVersion(PdfWriter.VERSION_1_5);
//writer.setPdfVersion(PdfWriter.VERSION_1_6);
document.open();
document.add(new Paragraph("This is a PDF-1.3 document"));
} catch (Exception ioe) {
System.err.println(ioe.getMessage());
}
document.close();
}
}


// setting a PDF to version 1.2
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class PdfVersion1_2 {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("PDFversion1_2.pdf"));
writer.setPdfVersion(PdfWriter.VERSION_1_2);
document.open();
document.add(new Paragraph("This is a PDF-1.2 document"));
} catch (Exception ioe) {
System.err.println(ioe.getMessage());
}
document.close();
}
}

This all leads me to believe that there must be a way. Even if I don't
end up going the programming route, it's still good to know though.

Thanks in advance for any responses.
Wayne

Jan 25 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.