or enforce a UI limit on how many transactions can be placed into a single report request.
Or, if you insist of creating such large file, you can try to NOT create the file in memory but on the filesystem and try to append new pages. I'm not sure if it will work not do I want to try it myself......
Or, if you insist of creating such large file, you can try to NOT create the file in memory but on the filesystem and try to append new pages. I'm not sure if it will work not do I want to try it myself......
My experience with pdf libraries is that they dont generally support this. Even if you could: would the users pdf reader even be able to open it?
If the answer I provided is useful or informative please check the "answer" button.
Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
My experience with pdf libraries is that they dont generally support this
I've done this many times ? However, I'm not sure if you open an existing file on the filesystem to append a new page, if the whole pdf will be copied into memory, because if it does, then the problem remains the same!
JeffreyABecker
Even if you could: would the users pdf reader even be able to open it?
I've found no indication that there's a limit to a pdf file size.
But then where back to the other problem you identified. Is somebody really interested in opening a large file like this with so many pages?
But then where back to the other problem you identified. Is somebody really interested in opening a large file like this with so many pages?
One example is a report containing billing transactions for many people that needs to be printed and snail-mailed.
Not sure what the OP needs or exactly what type of 'transactions' are involved and never have used the ReportViewer control or RDLC, but depending the type/purpose of report PDF generated, this is definitely possible using iTextSharp:
http://kuujinbo.info/cs/itext_template1.aspx
http://kuujinbo.info/cs/itext_template2.aspx
If you take a look at the second example there's a simple demo. Use something similar at work to generate PDF with between 1000-1300 pages. If your worried about memory/CPU overhead, the application runs on a pathetic VM host server (my laptop runs faster)
without problem. The file size usually ends up being around 1-3MB. (that's not a typo)
However, this method will take a little effort to achieve. You'll need to invest some time in learning the API and may even have to, perish the thought, actually take a look into the source code.
The mailing list is also very helpful as long as you put some thought into asking a question.
but depending the type/purpose of report PDF generated, this is definitely possible using iTextSharp:
Off couse this can be done with iTextSharp (or any other pdf library). The problem is that it grows to big, using up all resources.
kuujinbo
your worried about memory/CPU overhead, the application runs on a pathetic VM host server (my laptop runs faster) without problem. The file size usually ends up being around 1-3MB. (that's not a typo)
I've seen many pdf's with a couple of pages being larger. It all depands what you put in the file, and in this situation with large files, you're right that you need to keep the filesize as small as possible. In this case, the pdf is apparantly much larger
than yours (pictures?), resulting in a memory problem. Perhaps optimizing the code to generate the file will solve the problem (but what if the number of pages grows, their can be a moment that the memory becomes an issue again!) When you increase the number
of pages in your examples, at one moment you'll get this problem also.
I've seen many pdf's with a couple of pages being larger. It all depands what you put in the file, and in this situation with large files, you're right that you need to keep the filesize as small as possible. In this case, the pdf is apparantly much larger
than yours (pictures?), resulting in a memory problem. Perhaps optimizing the code to generate the file will solve the problem (but what if the number of pages grows, their can be a moment that the memory becomes an issue again!) When you increase the number
of pages in your examples, at one moment you'll get this problem also.
I don't disagree with any of what you're saying. That's why I was careful to say it's
one possiblesolution. The OP didn't indicate if there are indeed images in the PDF, so it's hard to tell. And besides images there could be a number of other reasons for large file size even for a two or three page PDF; embedded fonts,
not properly re-using a template (if a template is being used at all), etc.
The OP did say the PDF only contains 1500 - 2000 pages, so I didn't read anything further into the answer. As stated I use something similar to the examples (but a lot more complicated) at work that easily generates 1000-1300 page PDFs on a crippled
server and it runs fine. 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.
lasantha
Contributor
2361 Points
844 Posts
Re: How to generate large pdf's?
Aug 12, 2010 08:14 AM|LINK
hans_v , you correct
lasantha
Contributor
2361 Points
844 Posts
Re: How to generate large pdf's?
Aug 12, 2010 08:16 AM|LINK
hans_v, have you any idea
hans_v
All-Star
35998 Points
6551 Posts
Re: How to generate large pdf's?
Aug 12, 2010 08:25 AM|LINK
I already gave you one! I totaly agree that it makes no sence to create such large files!!!!
JeffreyABeck...
All-Star
16423 Points
3329 Posts
Re: How to generate large pdf's?
Aug 12, 2010 11:34 AM|LINK
Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
hans_v
All-Star
35998 Points
6551 Posts
Re: How to generate large pdf's?
Aug 12, 2010 11:40 AM|LINK
Or, if you insist of creating such large file, you can try to NOT create the file in memory but on the filesystem and try to append new pages. I'm not sure if it will work not do I want to try it myself......
JeffreyABeck...
All-Star
16423 Points
3329 Posts
Re: How to generate large pdf's?
Aug 12, 2010 01:00 PM|LINK
My experience with pdf libraries is that they dont generally support this. Even if you could: would the users pdf reader even be able to open it?
Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
hans_v
All-Star
35998 Points
6551 Posts
Re: How to generate large pdf's?
Aug 12, 2010 01:21 PM|LINK
I've done this many times ? However, I'm not sure if you open an existing file on the filesystem to append a new page, if the whole pdf will be copied into memory, because if it does, then the problem remains the same!
I've found no indication that there's a limit to a pdf file size.
But then where back to the other problem you identified. Is somebody really interested in opening a large file like this with so many pages?
kuujinbo
Participant
945 Points
164 Posts
Re: How to generate large pdf's?
Aug 15, 2010 12:41 AM|LINK
One example is a report containing billing transactions for many people that needs to be printed and snail-mailed.
Not sure what the OP needs or exactly what type of 'transactions' are involved and never have used the ReportViewer control or RDLC, but depending the type/purpose of report PDF generated, this is definitely possible using iTextSharp:
http://kuujinbo.info/cs/itext_template1.aspx
http://kuujinbo.info/cs/itext_template2.aspx
If you take a look at the second example there's a simple demo. Use something similar at work to generate PDF with between 1000-1300 pages. If your worried about memory/CPU overhead, the application runs on a pathetic VM host server (my laptop runs faster) without problem. The file size usually ends up being around 1-3MB. (that's not a typo)
However, this method will take a little effort to achieve. You'll need to invest some time in learning the API and may even have to, perish the thought, actually take a look into the source code.
The mailing list is also very helpful as long as you put some thought into asking a question.
http://kuujinbo.info/ | HTTP 301
hans_v
All-Star
35998 Points
6551 Posts
Re: How to generate large pdf's?
Aug 15, 2010 01:15 AM|LINK
Off couse this can be done with iTextSharp (or any other pdf library). The problem is that it grows to big, using up all resources.
I've seen many pdf's with a couple of pages being larger. It all depands what you put in the file, and in this situation with large files, you're right that you need to keep the filesize as small as possible. In this case, the pdf is apparantly much larger than yours (pictures?), resulting in a memory problem. Perhaps optimizing the code to generate the file will solve the problem (but what if the number of pages grows, their can be a moment that the memory becomes an issue again!) When you increase the number of pages in your examples, at one moment you'll get this problem also.
kuujinbo
Participant
945 Points
164 Posts
Re: How to generate large pdf's?
Aug 15, 2010 05:21 AM|LINK
I don't disagree with any of what you're saying
. That's why I was careful to say it's
one possible solution. The OP didn't indicate if there are indeed images in the PDF, so it's hard to tell. And besides images there could be a number of other reasons for large file size even for a two or three page PDF; embedded fonts,
not properly re-using a template (if a template is being used at all), etc.
The OP did say the PDF only contains 1500 - 2000 pages, so I didn't read anything further into the answer. As stated I use something similar to the examples (but a lot more complicated) at work that easily generates 1000-1300 page PDFs on a crippled server and it runs fine. 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.
http://kuujinbo.info/ | HTTP 301