Adobe Reader Printing Concern - adobe

I am using command line version of Adobe Reader DC to print PDF file.
I am getting PDF file having some pages with more width and having content like it fit to landscape page.
selecting printer to print this file with Letter size. 2550 * 3300.
So in output all TIF should be generated with Letter size.
My concern is with generated output TIF files,
Default Setting :
Orientation : Auto Potrait/Landscape Orienation and PageSize : Shrink Oversized Pages
With default printing setting, pages with higher width are rotated (Image dimensions : 2550 * 3300)
With selection of check box (Choose paper source by pdf size) , rotation issue resolved but Image dimension not consistent to Letter size.
Is there any way we can print images with Auto Potrait/Landscape Orienation and can maintain Image dimension with letter size ?
Like if Page with higher width can be printed with Landscape orienation at that time Image dimensions : 3300* 2550 ?
I want each page to print properly as per selection of size(ex: Letter,A4 etc..)
Note: if i do not select 'Choose paper source by pdf size' then pages with higher width gets rotated.

Related

QTextDocument's print size changes when it is set as a document of QTextEdit

i faced very interesting problem (at least for me).
When I do not set a QTextDocument as a document of QTextEdit with QTextEdit's setDocument method it is shown very small in previews and pdfs like in the image, only occupies very small place of the page with whole data and there are no page margins :
image http://imgim.com/small2.png
However, when I set it as a document of an arbitrary QTextEdit it is suprisingly shown normal in the page and page margins are adjusted (i.e. whole data is shown with 3 pages as normal)
QTextEdit* displayAreaxd = new QTextEdit;
displayAreaxd->setDocument(mainDocument);
This two lines of code changes all appearance in previews and pdf files when I use QTextDocument.print. and displayAreaxd is not even used after and mainDocument is a QTextDocument that is a private member of my class.
So I wonder what may cause this
I produce previews like :
QPrinter printer(QPrinter::HighResolution);
printer.setPaperSize(QPrinter::A4);
QPrintPreviewDialog preview(&printer, this);
connect(&preview, SIGNAL(paintRequested(QPrinter*)), SLOT(preview(QPrinter*)));
preview.exec();
my preview function is basicly where printer is coming from upper method :
mainDocument->print(printer);
my mainDocument is created and initialized like :
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setPaperSize(QPrinter::A4);
mainDocument = new QTextDocument;
mainDocument->setPageSize(printer.pageRect().size());
After that I do some drawings with normal fonts and normal image size according to a4 page but it appears like in the image when i do not set my document to a document of an arbitrary qtextedit
Edit:
When I added the code :
QFont docFont = QFont();
docFont.setPointSize(150);
mainDocument->setDefaultFont(docFont);
The text appears big, but I worry about if it can change font size with different resolutions or platforms, still I dont understand how point size changes when I set my document as a document of a text edit.
when I set document as a document of text edit document's width changes (decreases). because of this, present fonts look bigger in this pixel options. When I set my document's size to 9117*10530 this fonts looks smaller because their point size is small, when I set document as a document of text edit it's width decreases to 633 so with present point size of fonts they look normal.
So the text edit changes document's layout and width when setDocument is called.

How to define Body Size in Report Viewer ? (Visual studio 2010)

I create Report Viewer in my ASP.net project(.rdlc file) and I have problem when I export it to PDF.(I got extra blank page for every page).
I read a solution that I have to change the Body Size. Body ->Properties -> Size ..,
but I can't find size in Body Properties. That's the option I have there: (only Fill and Border)
Where can I change the body size?
Thanks!!
You can set Body size by left-clicking on body area and pressing F4.
You also have to set Report Size and Margins by right-clicking outside your report (grey area).
Note that Report size include Margins so you have to set Body size according to this; i.e. Body.Width = Report.Width - Report.Margins.Right - Report.Margins.Left

Generate Winnovative PDF to be a certain width/height pixel size

I'm looking to generate a PDF document from HTML using the Winnovative PDF Converter
I wish to convert the PDF to exactly 842 x 595 pixels
I've tried doing:
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A5
But this doesn't fit right. So I tried:
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.Custom
pdfConverter.PdfDocumentOptions.CustomPdfPageSize = New SizeF(842, 595)
However this doesn't work right either as I think the size is measured in a different format to pixels?
How can I generate a PDF at exactly 842 x 595 pixels so that it matches my HTML content?
There are 2 things involved when rendering the HTML content to PDF. The PDF page size and the converter internal HTML viewer width. When FitWidth is enabled the HTML content can be scaled down to fit the PDF page width.
The PDF page size is expressed in points (1 point is 1/72 inch) and the internal HTML viewer window size is expressed in pixels (i pixel is 1/96 inch).
The PDF page A4 potrait size is 595 x 842 points and the HTML viewer width corresponding to the 595 points is 595 x 96 / 72 = 793 pixels.
So the settings of the converter are:
pdfConverter.HtmlViewerWidth = 793
pdfConverter.PdfDocumentOptions.PdfPageSize = new PdfPageSize(595,842)
You can find a description of all the HTML scaling and fitting options and sample code in the Control HTML Scaling in PDF Page demo. Below is a copy of the relevant code from that demo:
protected void convertToPdfButton_Click(object sender, EventArgs e)
{
// Create a HTML to PDF converter object with default settings
HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();
// Set license key received after purchase to use the converter in licensed mode
// Leave it not set to use the converter in demo mode
htmlToPdfConverter.LicenseKey = "fvDh8eDx4fHg4P/h8eLg/+Dj/+jo6Og=";
// Html Viewer Options
// Set HTML Viewer width in pixels which is the equivalent in converter of the browser window width
// This is a preferred width of the browser but the actual HTML content width can be larger in case the HTML page
// cannot be entirely displayed in the given viewer width
// This property gives the size of the HTML content which can be further scaled to fit the PDF page based on selected options
// The HTML content size is in pixels and the PDF page size is in points (1 point = 1/72 inches)
// The converter is using a 96 DPI resolution to transform pixels to points with the following formula: Points = Pixels/96 * 72
htmlToPdfConverter.HtmlViewerWidth = int.Parse(htmlViewerWidthTextBox.Text);
// Set HTML viewer height in pixels to convert the top part of a HTML page
// Leave it not set to convert the entire HTML
if (htmlViewerHeightTextBox.Text.Length > 0)
htmlToPdfConverter.HtmlViewerHeight = int.Parse(htmlViewerHeightTextBox.Text);
// Set the HTML content clipping option to force the HTML content width to be exactly HtmlViewerWidth pixels
// If this option is false then the actual HTML content width can be larger than HtmlViewerWidth pixels in case the HTML page
// cannot be entirely displayed in the given viewer width
// By default this option is false and the HTML content is not clipped
htmlToPdfConverter.ClipHtmlView = clipContentCheckBox.Checked;
// PDF Page Options
// Set PDF page size which can be a predefined size like A4 or a custom size in points
// Leave it not set to have a default A4 PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageSize = SelectedPdfPageSize();
// Set PDF page orientation to Portrait or Landscape
// Leave it not set to have a default Portrait orientation for PDF page
htmlToPdfConverter.PdfDocumentOptions.PdfPageOrientation = SelectedPdfPageOrientation();
// Set PDF page margins in points or leave them not set to have a PDF page without margins
htmlToPdfConverter.PdfDocumentOptions.LeftMargin = float.Parse(leftMarginTextBox.Text);
htmlToPdfConverter.PdfDocumentOptions.RightMargin = float.Parse(rightMarginTextBox.Text);
htmlToPdfConverter.PdfDocumentOptions.TopMargin = float.Parse(topMarginTextBox.Text);
htmlToPdfConverter.PdfDocumentOptions.BottomMargin = float.Parse(bottomMarginTextBox.Text);
// HTML Content Destination and Spacing Options
// Set HTML content destination in PDF page
if (xLocationTextBox.Text.Length > 0)
htmlToPdfConverter.PdfDocumentOptions.X = float.Parse(xLocationTextBox.Text);
if (yLocationTextBox.Text.Length > 0)
htmlToPdfConverter.PdfDocumentOptions.Y = float.Parse(yLocationTextBox.Text);
if (contentWidthTextBox.Text.Length > 0)
htmlToPdfConverter.PdfDocumentOptions.Width = float.Parse(contentWidthTextBox.Text);
if (contentHeightTextBox.Text.Length > 0)
htmlToPdfConverter.PdfDocumentOptions.Height = float.Parse(contentHeightTextBox.Text);
// Set HTML content top and bottom spacing or leave them not set to have no spacing for the HTML content
htmlToPdfConverter.PdfDocumentOptions.TopSpacing = float.Parse(topSpacingTextBox.Text);
htmlToPdfConverter.PdfDocumentOptions.BottomSpacing = float.Parse(bottomSpacingTextBox.Text);
// Scaling Options
// Use this option to fit the HTML content width in PDF page width
// By default this property is true and the HTML content can be resized to fit the PDF page width
htmlToPdfConverter.PdfDocumentOptions.FitWidth = fitWidthCheckBox.Checked;
// Use this option to enable the HTML content stretching when its width is smaller than PDF page width
// This property has effect only when FitWidth option is true
// By default this property is false and the HTML content is not stretched
htmlToPdfConverter.PdfDocumentOptions.StretchToFit = stretchCheckBox.Checked;
// Use this option to automatically dimension the PDF page to display the HTML content unscaled
// This property has effect only when the FitWidth property is false
// By default this property is true and the PDF page is automatically dimensioned when FitWidth is false
htmlToPdfConverter.PdfDocumentOptions.AutoSizePdfPage = autoSizeCheckBox.Checked;
// Use this option to fit the HTML content height in PDF page height
// If both FitWidth and FitHeight are true then the HTML content will resized if necessary to fit both width and height
// preserving the aspect ratio at the same time
// By default this property is false and the HTML content is not resized to fit the PDF page height
htmlToPdfConverter.PdfDocumentOptions.FitHeight = fitHeightCheckBox.Checked;
// Use this option to render the whole HTML content into a single PDF page
// The PDF page size is limited to 14400 points
// By default this property is false
htmlToPdfConverter.PdfDocumentOptions.SinglePage = singlePageCheckBox.Checked;
string url = urlTextBox.Text;
// Convert the HTML page to a PDF document using the scaling options
byte[] outPdfBuffer = htmlToPdfConverter.ConvertUrl(url);
// Send the PDF as response to browser
// Set response content type
Response.AddHeader("Content-Type", "application/pdf");
// Instruct the browser to open the PDF file as an attachment or inline
Response.AddHeader("Content-Disposition", String.Format("attachment; filename=HTML_Content_Scaling.pdf; size={0}", outPdfBuffer.Length.ToString()));
// Write the PDF document buffer to HTTP response
Response.BinaryWrite(outPdfBuffer);
// End the HTTP response and stop the current page processing
Response.End();
}
If you set the PdfConverter.PageWidth and PdfConverter.PageHeight attributes to 842 and 595 then that should cause your web content to fill the whole PDF page area.
There is also a FitWidth property which can be set to False if you want your web content to not be scaled down to fit the available page area. This will mean that your content will overflow the page if it is too large though.
Another point to raise about Winnovative PDF is that it is not easy to work with high resolution images, so depending on your PDF needs (and input) you may struggle to get good quality images - maybe that was just from my experience though.
Speaking of images, it seems that Winnovative PDF takes your input html and creates a single image of it all which then gets added to the PDF at screen resolution (72 dpi) and this can even make simple text look low quality.
If you fancied having a go at handle the html layout yourself you could always convert your content straight to PDF using another product such as ITextSharp which would allow more flexibility over higher resolution images. I really depends on your overall needs though

asp.net image display as a percentage

I have a page that accepts image uploads up to 4MB. The images can be as small as 100x100 or even as large as 1900 x 1200. I'm using a pop-up window to display the uploaded image.
The problem is that I want to scale the larger images programmatically (but not modify the image itself). I want to display the large images at 80% (or 60% or whatever) if possible. I've seen browsers display an image at XX % then when you click on an icon, then the image will be displayed at 100%.
That's the effect I'm trying to accomplish.
I would use the code located http://www.codeproject.com/KB/GDI-plus/imageresize.aspx
Then I would onclick of an icon pass the percentage value to that function and the render the result.

Problems when printing a SWF in browser

I'm trying to print a SWF and have come across some problems.
When using the Print function in the browser, the SWF will be distorted, and not scaled correctly. So I've tried to implement a Print function using Actionscript instead.
The different approaches I've taken are:
Printing using the right click context menu of the Flash Player and choose Print. This works almost as expected, but It flattens transparent PNGs and isn't scaled correctly.
Creating a FlexPrintJob and adding the component to the job. Will not scale the component to fit the page, even though I've set FlexPrintJobScaleType.SHOW_ALL on the print job.
Creating a PrintView containing an Image. Then taking a screenshot of the component and set this as the Image in the PrintView. When this is done, I create a new FlexPrintJob and send it. This seems to work most of the times, but the scaling will distort and make small elements (like text) look really bad.
The code for printing looks like this:
var pj:FlexPrintJob = new FlexPrintJob();
if (pj.start())
{
pj.addObject(componentToBePrinted, FlexPrintJobScaleType.SHOW_ALL);
pj.send();
}
What I would like to do is to get the right click context menu to work, and by that I mean setting the scaling of the SWF. Is this possible? Are there any other alternatives when printing a SWF? What am I doing wrong?
When testing, I'm printing to a PDF, but I don't think that will change the results.
You need to scale your Print Job for what you want in FlexPrintJobScaleType:
MATCH_WIDTH
(Default) Scales the object to fill
the available page width. If the
resulting object height exceeds the
page height, the output spans multiple
pages.
MATCH_HEIGHT
Scales the object to fill the
available page height. If the
resulting object width exceeds the
page width, the output spans multiple
pages.
SHOW_ALL
Scales the object to fit on a single
page, filling one dimension; that is,
it selects the smaller of the
MATCH_WIDTH or MATCH_HEIGHT scale
types.
FILL_PAGE
Scales the object to fill at least one
page completely; that is, it selects
the larger of the MATCH_WIDTH or
MATCH_HEIGHT scale types.
NONE
Does not scale the output. The printed
page has the same dimensions as the
object on the screen. If the object
height, width, or both dimensions
exceed the page width or height, the
output spans multiple pages.
See http://livedocs.adobe.com/flex/3/html/help.html?content=printing_3.html
for more information on this.

Resources