form to A4 page @ 300dpi
So i'm creating a form, on the form is a panel (panel1) which holds all data, pictures etc... This is then to be made into a bmp for professional printing (ie 300dpi).
A4 @ 300dpi = 2480 x 3508;
i am able to create the image at the panel's height and width. and i have also recently got it to create a document 2480x3508, but the panel is being shown in the top left corner with a whole lot of white space.. what am i doing wrong?.. is there a Better way to create this image, as quality is a factor?.. this is my code below..
PANEL1
panel1.width = 826;
panel1.height = 1168;
Apologies if i sound noob.. ....but i am, have only just started with C#... thanks all.
Bitmap objBmpImage = new Bitmap((2480), (3508)); //create image
objBmpImage.SetResolution(300, 300); // set resolution to 300 dpi
Graphics objGraphics = Graphics.FromImage(objBmpImage); //create graphics object
panel1.DrawToBitmap(objBmpImage, new System.Drawing.Rectangle(0,0, 2480, 3508)); //draw panel onto image
using (SaveFileDialog dlgSave = new SaveFileDialog()) //SFD for user to select destination... which isnt working correctly either, but thats another issue
{
dlgSave.Title = "Save Image";
dlgSave.Filter = "Bitmap Images (*.bmp)|*.bmp|All Files (*.*)|*.*";
//make high quality
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
objGraphics.CompositingMode = CompositingMode.SourceCopy;
objGraphics.CompositingQuality = CompositingQuality.HighQuality;
objGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
//draw image
objGraphics.DrawImage(objBmpImage, 0, 0, 2480, 3508);
//save
objBmpImage.Save(@"F:\new.bmp");
walid86
Junior Poster in Training
65 posts since Sep 2011
Reputation Points: 17
Solved Threads: 1
Thanks, i've got the image outputting as required, just having a few issues using abcpdf to output to an A4 document.
It outputs to a letter sized document all fine and correctly, ( but not helpful for printing), but upon changing document size to A4, the output is distorted..
ie, picture starts 50pixels or so from the top, and is wider than the page.
anyone ever use abcpdf and come accros this? any tips, or ideas?..
walid86
Junior Poster in Training
65 posts since Sep 2011
Reputation Points: 17
Solved Threads: 1
i fixed the issue. Turns out putting..
Doc myDoc = new Doc();
myDoc.MediaBox.String = "A4";
myDoc.Rect.String = myDoc.MediaBox.String; // <- this line fixes the issue Important
myDoc.Page = myDoc.AddPage();
It's asif the page size was not set for that page, think you need to assign it the string so it creates that size page, before you add it to the document..
Hope that made sense.. but code and printing works fine with this code now..
btw: ABCpdf is like $400+ for a license?? pricey isnt it?...
Thanks to all posters!.
Happy coding...
walid86
Junior Poster in Training
65 posts since Sep 2011
Reputation Points: 17
Solved Threads: 1