This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, October 7, 2009 3:05:04 AM(UTC)
Groups: Registered
Posts: 7
What I have to do to save a RasterImage in pdf format?
#2
Posted
:
Wednesday, October 7, 2009 5:43:54 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Do you want to save the loaded RasterImage object into a searchable PDF file or as a Raster PDF file format?
If you want it to be saved as a searchable PDF, you will need to use the LEADTOOLS Document Imaging OCR features to recognize the text on the image, then store it as PDF.
If you want to save to a Raster PDF file, simply load the RasterImage and save it as raster PDF using the RasterImageFormat.RasPdf* format such as RasPdfLzw.
The exact details depend on your requirements and which LEADTOOLS toolkit and version (15, 16, etc.) you are using.
#3
Posted
:
Wednesday, October 7, 2009 9:30:23 PM(UTC)
Groups: Registered
Posts: 7
Normal
0
21
false
false
false
ES
X-NONE
X-NONE
I need to load a pdf file into a RasterImage, add, move, or delete pages, then do the OCR, save the meta-fields into the database and finally replace the old pdf file with the modified one.I have a problem:I want to load into a RasterImage a pdf file (135KB). I use the follow instruction. (Documento is a IOcrDocument).RasterCodecs.Startup();
codecs = new RasterCodecs();
codecs.Options.Pdf.Load.XResolution = 200;
codecs.Options.Pdf.Load.YResolution = 200;
RasterImage imagen = codecs.Load("aaa.pdf", 0, CodecsLoadByteOrder.BgrOrGray, 1, -1);
Documento.Pages.InsertPages(0, imagen, 1, -1, null);The problem is that the RasterImage now have a size of more than 100MB and when I try to save it to the hard disk it is to big.I need to load the pdf file in good cuality because I whant to do OCR. But 100MB its to big.What I have to do to optimize this?This is the code I use to save the pdf:codecs.Save(imagen,
"aaa.pdf",
RasterImageFormat.RasPdf,
0,
1,
imagen.PageCount,
1,
CodecsSavePageMode.Overwrite);I have LeadTools Normal
0
21
false
false
false
ES
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Tabla normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
Version info (16.5.0.3).Thanks!File Attachment(s):
aaa.pdf (136kb) downloaded 22 time(s).
#4
Posted
:
Thursday, October 8, 2009 4:22:46 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
I noticed that you are saving the PDF file into RasterImageFormat.RasPdf, which is uncompressed PDF file. This explains the large size of the generated PDF file.
If all your PDF files contain text and they are black and white files, you can load them setting the codecs.Options.Pdf.Load.DisplayDepth property to 1. After that, when you save the file, save them as RasterImageFormat.RasPdfG4 or RasterImageFormat.RasPdfLzw.
If you want to keep the files colored, try to set the codecs.Options.Pdf.Load.DisplayDepth property to 24 and save the files with RasterImageFormat.RasPdfLzw.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.