It's common sense that you need to rethink the approach if, for example, you want to generate a PDF with let's say 10,000 pages instead.
And I think, like JeffreyABecker, that you need to rethink the approach if you generated a pdf of 1000 pages also!If I would get a report like the exmaple you gave, I want it in a digital format, because I will never ever read a pdf with just numbers that's
over 10 pages long, let alone more than 1000 pages. In a digital format, I can do calculations, group things together etc, in pdf I can't.
And I think, like JeffreyABecker, that you need to rethink the approach if you generated a pdf of 1000 pages also!If I would get a report like the exmaple you gave, I want it in a digital format, because I will never ever read a pdf with just numbers that's
over 10 pages long, let alone more than 1000 pages. In a digital format, I can do calculations, group things together etc, in pdf I can't.
No offense, but you're reading a lot more into OP's question and my potential answer
to that question, i.e getting off topic. Only the OP knows exactly what's needed. The OP
specifically asked for a way to generate a PDF file, NOT a digital format that "can do calculations, group things together etc" - that's what
you want, not what the OP has asked for.
And I already said what I'M using the report for, to quote:
One example is a report containing billing transactions for many people that needs to be printed and snail-mailed.
In this case the report isn't meant to be read by the person generating the report, only by the customers that get a hard-copy via snail-mail.
The application on this site installs a printer driver: When you print to it, a PDF file is created. I've used it with many applications but never programmatically tried to print to it.
I see that many people recommend you to use ITextSharp, in my view this is right solutuion but:
1) Use ITextSharp to generate PDF small files, for example with 50 pages at once
2) Next merge that PDF files into one large single document
To merge PDF files you may use the PDF Metamorphosis .Net, it's commercial product and I'm owner of company who created this product.
But I don't offer you to purchase it, you may simply use the method MergePDF, it doesn't have any limits and in my view will help you to solve this task for free.
I've tried to merge PDF rereference 1.3 which contains 700 pages with another PDF, it takes ~ 8 sec.
This is C# sample:
SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();
string [] pdfFiles = {@"D:\PDFReference13.pdf",@"D:\dest1.pdf"};
p.MergePDF(pdfFiles, @"d:\dest2.pdf");
Actually the best way is merge PDF in memory, you may also do this with method 'MergePDF'.
Actually the best way is merge PDF in memory, you may also do this with method 'MergePDF'.
But will this solve his problem? Because now the memory is the problem. When you merge 2 documents with the same data into 1 document in memory, the amount of memory need will be the same, or not? I think in this case, the merging of the smallerr documents
into 1 should NOT be done in memory?
u cant create direct from html or aspx. the easy way is bring all ur data in one server side control and then create pdf of it. i have used itextsharp dll for that code is as follow
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Quotation.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
tblall.RenderControl(hw);
//here is tblall as server side table
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
pdfDoc.AddHeader("this is header part ", "this is header content remeber spell");
hans_v
All-Star
35986 Points
6550 Posts
Re: How to generate large pdf's?
Aug 15, 2010 11:01 AM|LINK
And I think, like JeffreyABecker, that you need to rethink the approach if you generated a pdf of 1000 pages also!If I would get a report like the exmaple you gave, I want it in a digital format, because I will never ever read a pdf with just numbers that's over 10 pages long, let alone more than 1000 pages. In a digital format, I can do calculations, group things together etc, in pdf I can't.
kuujinbo
Participant
945 Points
164 Posts
Re: How to generate large pdf's?
Aug 15, 2010 11:08 PM|LINK
No offense, but you're reading a lot more into OP's question and my potential answer to that question, i.e getting off topic. Only the OP knows exactly what's needed. The OP specifically asked for a way to generate a PDF file, NOT a digital format that "can do calculations, group things together etc" - that's what you want, not what the OP has asked for.
And I already said what I'M using the report for, to quote:
One example is a report containing billing transactions for many people that needs to be printed and snail-mailed.
In this case the report isn't meant to be read by the person generating the report, only by the customers that get a hard-copy via snail-mail.
http://kuujinbo.info/ | HTTP 301
SGWellens
All-Star
126031 Points
10310 Posts
Moderator
Re: How to generate large pdf's?
Aug 16, 2010 01:45 AM|LINK
There is another option you may wish to explore (in case you aren't confused enough).
http://www.dopdf.com/
The application on this site installs a printer driver: When you print to it, a PDF file is created. I've used it with many applications but never programmatically tried to print to it.
My blog
SautinSoft
Member
194 Points
103 Posts
Re: How to generate large pdf's?
Aug 16, 2010 06:12 AM|LINK
Hi,
I see that many people recommend you to use ITextSharp, in my view this is right solutuion but:
1) Use ITextSharp to generate PDF small files, for example with 50 pages at once
2) Next merge that PDF files into one large single document
To merge PDF files you may use the PDF Metamorphosis .Net, it's commercial product and I'm owner of company who created this product.
But I don't offer you to purchase it, you may simply use the method MergePDF, it doesn't have any limits and in my view will help you to solve this task for free.
I've tried to merge PDF rereference 1.3 which contains 700 pages with another PDF, it takes ~ 8 sec.
This is C# sample:
SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis(); string [] pdfFiles = {@"D:\PDFReference13.pdf",@"D:\dest1.pdf"}; p.MergePDF(pdfFiles, @"d:\dest2.pdf");Actually the best way is merge PDF in memory, you may also do this with method 'MergePDF'.
Let me know if you will have questions.
Max
hans_v
All-Star
35986 Points
6550 Posts
Re: How to generate large pdf's?
Aug 16, 2010 07:32 AM|LINK
But will this solve his problem? Because now the memory is the problem. When you merge 2 documents with the same data into 1 document in memory, the amount of memory need will be the same, or not? I think in this case, the merging of the smallerr documents into 1 should NOT be done in memory?
vaibh
Member
175 Points
88 Posts
Re: How to generate large pdf's?
Aug 16, 2010 07:48 AM|LINK
Hi
u cant create direct from html or aspx. the easy way is bring all ur data in one server side control and then create pdf of it. i have used itextsharp dll for that code is as follow
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Quotation.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
tblall.RenderControl(hw);
//here is tblall as server side table
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
pdfDoc.AddHeader("this is header part ", "this is header content remeber spell");
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();
pdf csharp
MCTS Web Application
Software Developer
http://www.vaibhavmayee.com
If u like the solution then mark as answer !!
daccit
Member
36 Points
22 Posts
Re: How to generate large pdf's?
Aug 19, 2010 10:16 AM|LINK
Hi,
You must refer a article http://www.adobe.com/designcenter/acrobat/articles/acr7lgpg.html at this link. It will help u.
Thanks