|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
I cannot find the option to set the page orientation for a PdfDocument. I'd like to be able to set to landscape for "some" reports. Is this supported? sorry, i just can't locate it in the documentation.
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
Thanks for the reference. however, I am not using the htmltopdf method, I am building the file using the PDFDocument, AcmRender, AcmTable to load data from a SqlDataReader. Similiar to your Advanced Table example. From your resource, I was able to extrapolate this:
Code: C#
render.SetDefPageSize(new System.Drawing.SizeF(11F, 8.5F));
render.Render(p1, table);
This does render a landscape layout. Is this the correct way to do this?? Also, I am creating the file on the filesystem, then calling a Process.Start(file) to open the file. I'd rather not put a hard copy on the web server if I can avoid it. A better alternative would be to just open the file in memory and let the user print or save it as they desire. How would I accomplish this? Here's what I am doing...
Code: C#
PdfDocument doc = new PdfDocument();
string Title, Author, ItemType, ListPrice, ISBN, Dewey, DOP;
//Create a new AcmRender object
AcmRender render = new AcmRender(doc);
AcmParagraph p1 = new AcmParagraph(new AcmText("List Detail Report"));
p1.Style.FontSize = 15f;
p1.Style.FontStyle = System.Drawing.FontStyle.Bold;
//Create the root paragraph
AcmTable table = new AcmTable(2, 2, 1, 1, 1, 1, 1);
table.CellPadding = 0.05f;
table.GridLineType = AcmGridLineType.All;
table.GridLineInfo = new AcmLineInfo(System.Drawing.Color.LightGray, 0.001f);
CreateTableRow(table, "Title", "Author", "Item Type", "List Price", "ISBN", "Dewey", "DOP");
while (reader.Read())
{
Title = reader.GetString(reader.GetOrdinal("Title")).ToString();
Author = reader.GetString(reader.GetOrdinal("Author")).ToString();
ItemType = reader.GetString(reader.GetOrdinal("ItemType")).ToString();
ListPrice = String.Format("{0:c}", reader.GetDecimal(reader.GetOrdinal("ListPrice")));
ISBN = reader.GetString(reader.GetOrdinal("ISBN")).ToString();
Dewey = reader.GetString(reader.GetOrdinal("DeweyNbr")).ToString();
DOP = reader.GetString(reader.GetOrdinal("DOP")).ToString();
CreateTableRow(table, Title,
Author,
ItemType,
ListPrice,
ISBN,
Dewey,
DOP
);
}
//Render the text
render.Render(p1, table);
//Save the PDF file
string file = Server.MapPath("ListDetailReport.pdf");
doc.Save(file);
// Open the file for viewing.
Process.Start(file);
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
I found this works better for the page size.
render.SetDefPageSize(new System.Drawing.SizeF(new System.Drawing.SizeF(PdfPageSizes.A4.Height, PdfPageSizes.A4.Width)));
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, Your code about the page size is correct. If your code runs in an ASP.NET application, then you can avoid creating a real file. See here for more details: http://doc.essentialobjects.com/library/4/web/pdf_on_demand.aspxFor traditional desktop application, you will have to create a real file because that's the only way to pass the file to Adobe Reader. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
Thanks for your reply. In your reference, there is a description of the ASPXtoPDF control.
"ASPXToPDF is declared in EO.Web.dll. So you must reference that DLL first. If you do not have EO.Web Controls on your development machine, please download it from our download page and install it (you do not need a license for EO.Web Controls to use ASPXToPDF). Once EO.Web Controls is installed, you can simply drag and drop ASPXToPDF from Visual Studio's toolbox to your Web Form to place the control in your form and add the reference at the same time."
I am not seeing this control in my EO controls toolbox. I loaded controls from the current 2010 version of EO.Web.dll.
Why am I not seeing that control? Thanks,
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
That control does not exist in EO.Web Controls 2010. It's in EO.Web Controls 2011. The current version is EO.Web Controls 2011.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/4/2007 Posts: 114
|
OIC - Would our license for version 2010 be valid for the 2011 version?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
It should cover it till one year after your purchase date. We've sent you a private message with more details. You can click "inbox" at the top of the forum to view the message.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/24/2015 Posts: 3
|
Thank you so much. I'm going to try it now.
|
|
Rank: Newbie Groups: Member
Joined: 3/24/2015 Posts: 3
|
Hi, support I also want to add bar code to the header of PDF pages. So happy to find so many solutions you provided here. I really love your work, thank you so much!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Glad to hear that you like our product. EO.Pdf does not have any built-in barcode support. However if you use another barcode creation library you can simply use the output of the that library and place it in the PDF file.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 3/24/2015 Posts: 3
|
eo_support wrote:Hi, Glad to hear that you like our product. EO.Pdf does not have any built-in barcode support. However if you use another barcode creation library you can simply use the output of the that library and place it in the PDF file. Thanks! But I think it would be better if an interface provide for bar code control. Still thank you for your help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
longwest wrote:But I think it would be better if an interface provide for bar code control. Still thank you for your help. Thanks for the feedback. We do not have any plans to include barcode feature directly in EO.Pdf as for now since they are really two completely unrelated things. We do understand that customers often use them together though, so we might still add it in a future version.
|
|
Rank: Member Groups: Member
Joined: 12/26/2015 Posts: 14
|
Seeing that this is an older post..I'm having the same issues. I am loading PdfDocument from Byte data from an SQL server and need to know if the document it has loaded is in portrait or landscape (because I need to put a footer on it...and so style.top is going to be different based on page orientation. so IS there a way to see what orientation the document is using? Because no matter what I load, the Size.Height and Width are all for Portrait.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Monte wrote:Seeing that this is an older post..I'm having the same issues. I am loading PdfDocument from Byte data from an SQL server and need to know if the document it has loaded is in portrait or landscape (because I need to put a footer on it...and so style.top is going to be different based on page orientation. so IS there a way to see what orientation the document is using? Because no matter what I load, the Size.Height and Width are all for Portrait.
Have you checked PdfPage.MediaBox.Size? That property should show different values. Note the value in PdfPage.Size is in inches, but PdfPage.MediaBox.Size is in PDF unit. A PDF unit usually equals 1/72 inch. Thanks!
|
|