Can a crystal report be scaled to fit page?
I'm hoping to achieve something similar to Microsoft Excel's Scale To Fit feature wherein a large spreadsheet can be scaled to fit a 8.5"x 11" page.
(On MS Excel 2007 goto Page Layout > Scale To Fit).
Im searching of a way to make a large report fit into a smaller page during print.
for example a report designed in Legal(8.5"x 14") page must be able to shrink when print
previewed for Letter(8.5"x 11") page.
In my crystal report, it should be scaled to fit the page by default.
I was thinking maybe theres a Crystal Report Setting or C# code technique that I missed out.
Any hint or link to the right direction is appreciated.
Thanks!
If you change the paper size programmatically, you will lose some of the canvas (hence fields).
Moreover, I'm not aware of any native API calls to scale the report as you request.
Workarounds:
print the report to PDF. In my experience, the Acrobat viewer will automatically scale the document to 8.5" x 11". Take a look at the article I wrote about correcting the automatic scaling: Adobe Acrobat – Printing Legal Landscape Documents
export the report to Excel, then use its shrink-to-fit option.
create a custom printer driver (akin to MS XPS image writer) to scale the image before printing--clearly not an easy task
Related
I have 16 Reports in my current application. when I export the reports
through Export drop down menu to PDF file, it saves to my local disk.
But when I open the PDF through Adobe Acrobat Reader it opens it with
a different zoom size for each report. Why I am getting this kind of
behavior.
Can I set a default zoom size for all the generated PDF
dynamically ??
You can't change the zoom level of generated PDFs in Reporting Services.
The zoom is managed by the viewer application, which is Adobe Acrobat Reader in your case.
There is no details about it in the documentation because this feature does not exist, but here is a link to a question on MSDN forums where somebody from Microsoft confirms that there are no ways of doing it:
export SSRS report to pdf / controlling zoom
right click on report and
1) go to report properties
after that you set height and width as per your requirement
I am just wondering if I can have a pdf document as a format for crystal report
situation
I have a form in a pdf format where I must fill up the blanks and I wanted my program will fill the form using crystal report because eventually i have to print the particular form
reason
the form has so many data and questions to imitate
A potential way to accomplish your end result (PDF populated with data, printed to paper) would be to:
export the PDF as an image (there are several printer drivers that can do this)
import the image into the Crystal Report - note this is really only a temporary step to help with layout
Arrange your data fields over the blanks in your form
For better print output quality, I recommend removing the image from the report at this point, and printing to each page twice (first for the PDF template, then over top of that with the Crystal Report data, which is now happily arranged exactly where the blank spots are on your page).
I am creating an rdlc report in VS 2010 .
When I see my report in reportviewer it seems OK to me but when i export that report to PDF its format changes and reportviewer format do not match with PDF format....
I want to have same format in report
How can i resolve this problem....
This is a bit difficult to answer without knowing exactly what changes but I would assume this is down to page widths etc as thats one of the most common issues I've seen.
Your PDF is going to render the data in pages to fit on whatever the default is, probably A4 for uk or I believe Letter for USA, so the best way to get consistent results is to set the page size of your report to whatever size you are going to be printing it out on, and have fixed sizes, do not let things resize on their own.
If you want to update your answer with what is changing I can possibly help you more.
I am working on a WinForms app that uses the ReportViewer control to show a few Reporting Services reports. On these screens, we allow the user to print the report by calling the PrintDialog() method on the ReportViewer like so:
_reportViewer.PrintDialog();
This works fine in most cases, it brings up the standard windows print dialog, the user chooses what printer they want to print to, and it prints. However, when the user chooses to print to PDF using "Adobe PDF", it throws a Win32Exception: The specified datatype is invalid. The file dialog to choose where to save the pdf doesn't even come up.
This only happens with Adobe PDF printer. I installed NitroPDF and used their PDF printer and it works without a problem.
Does anybody have an idea on what could be causing this to happen?
Edit:
Here is the stack trace:
at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Microsoft.Reporting.WinForms.ReportViewer.PrintDialog(PrinterSettings printerSettings)
at Microsoft.Reporting.WinForms.ReportViewer.PrintDialog()
This doesn't truly fix the problem but solves it in the users' eyes.
Trap the error thrown by the PDF Printer then invoke the Export to PDF functionality built into Reporting Services. It doesn't error in Winforms even when printing to the PDF Printer does. From the user perspective they "printed to pdf" like normal and the experience is identical. It's a work around that works. :-)
AFAIK the ReportViewer control just renders each page as a bitmap image. So when printing to PDF, if the resolution is high, it could be a huge bitmap. Maybe AdobePDF has problems with large bitmaps, Adobe have so many other bugs! Try lowering the resolution as a test?
I have an application that uses the ReportServer API to get the page bitmaps and chunks them into parts to be handled by a custom print processor
Could it be that the contents of the report are creating this problem. I mean to say that the report may contain certain characters that Adobe PDF printer is not able to recognize.
Can you try to print a very simple/basic/blank report and see if that works.
I've searched Stackoverflow and google and found many ways
how I can print stuff in C#.
The best way for me would be to populate blank white windows form
with some label, textbox and picturebox elements and print it as a windows form.
This way is very poor because it prints in 72 DPI, and is not flexible for multiple
pages print.
Next way that I found that would be good is using iTextSharp, but there is a problem
that iTextSharp only generates PDF-s, and you have to open it in PDF viewer and print
from there.
I love this way of thinking where I create a paragraph, and then fill it with text and graphic, so I found this thread
http://www.devarticles.com/c/a/C-Sharp/Printing-Using-C-sharp/
where it discusses how to create your own printing engine in C#, something like iTextSharp,
but very lightweight...
Now that I've said that, I want to know is there any ready to use printing engine that would be like iTextSharp, made for printing, not for PDF generation? What is the best way to print something, without using reporting services like CrystalReports.
I think Crystal Reports wouldn't work for my case cause I don't want to print generic reports, but some text and graphics that I need to dynamicaly generate every time I need to print.
I found that it was much easier to do printing using the printing stuff in WPF.
EDIT
XPS is the page description format that Microsoft included into .NET with .NET 3.0. It is nominally part of WPF, and is integrated with the WPF form layout model. But you can create XPS documents in memory and send them to printers, from any .NET app, including a WinForms App.
An example:
http://statestreetgang.net/post/2008/03/Creating-an-XPS-document-in-memory-via-the-DOM.aspx
It is approximately equivalent to the iTextSharp capability you explored, except:
you can do it all in memory if you like, no need to save to a filesystem file. Of course if you want to save to a filesystem file, you can do that too.
you don't need an external viewer in order to start the print.
If you are new in programming and you have some data like from Data Base, and you want to print it after retrieving it from Data Base. Then just follow this link it will guide you step by step.
Print Data in Dot Net (C#,Vb.net)