|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Hi, I am developing an app in Visual Basic (Visual Studio 10 Ultimate) and I want to create a pdf file from within the app. I have downloaded the eo software and have a slight problem (problem is probably my ignorance!). When I run the demo version of the Hello World app, it works perfectly - comes up on the screen. When I open the source code and try to run the same app, I get a message in red saying that I don't have Adobe pdf viewer installed. I assume that as the original demo worked that I do have it installed. I know I have Adobe Reader 9 installed is that the same thing?
Thanks
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Adrian,
This is a bug in the EOPdfDemo application. The demo application for different languages and different version of Visual Studio was automatically generated from a single "template" and that process has a problem. In any case, the components itself should work OK, so you can copy the code from the sample into your project and it should work for you. We will fix the demo application and post a new build as soon as possible.
Thank you very much for the feedback. Please feel free to let us know if you see any other problems.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Are you sure that'll work? I've got to try to work out which bit goes where in my app which may take quite some time.
Thnaks
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Yes. They will work. : ) The code is actually quite simple. The code will be slightly different depending on whether you wish to use "PDF Creator" or "HTML to PDF" interface. If you use HTML to PDF interface, you can take a look of this topic: http://doc.essentialobjects.com/library/4/htmltopdf/quick_start.aspxIf you use "PDF Ceator" interface, you can take a look of this: http://doc.essentialobjects.com/library/4/acm/getting%20started/hello_world.aspxIn either case it's only a few lines of code to get started. The same help contents are also available on your local machine as a .chm file. You can go to Start -> All Programs -> EO.Pdf for .NET 2011.2 -> Documentation to access the help file. The local .chm file will be faster than the online version. If you don't feel comfortable trying it out now, you can wait for a few days. We will have a new build ready early next week with the demo application fixed. We apologize for the problem and appreciate very much for your patience. Thanks
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Thanks for your quick response. I will try the code myself and if I can't quite get it right, I will wait for the new examples. How would I know when they are available?
Thanks again
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We will reply this thread again once we have an update build for this.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Hi eo_support,
I know you are looking at doing the new sample files but I was just wondering if you could tell me what is wrong with the following code then I could crack on with testing the software. The problem is that whatever I do the "Stream" is NULL - even if I hard code a file name. Don't really understand the Loadimage function!
Cheers
Adrian
Public Overrides Function RunDemo(outputFileName As String, args As IDemoArgs) As String 'Create a new PdfDocument Dim doc As New PdfDocument()
'Create a new AcmRender object Dim render As New AcmRender(doc)
'Create the root paragraph Dim p1 As New AcmParagraph(New AcmText("This is our logo:"))
'Create a new image Dim image As New AcmImage(LoadImage("EOLogo.gif")) image.Style.Padding.Left = 0.1F image.Style.OffsetY = 0.12F p1.Children.Add(image)
'Render the text render.Render(p1)
'Save the PDF file doc.Save(outputFileName)
Return Nothing End Function
Protected Function LoadImage(image As String) As System.Drawing.Image Dim stream As Stream = GetType(Demo).Assembly.GetManifestResourceStream("EOPDFDemo.Images." & image) Return System.Drawing.Image.FromStream(stream) End Function
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
It's not really your fault. : ) The resource name that is passed to GetManifestResourceStream is "EOPDFDemo.Images.EOLogo.gif". However the resource that got built into the EOPdfDemo.exe is "EOLogo.gif" (without the full path). This causes GetManifestResourceStream to return null for you.
You can either change the resource name to "EOLogo.gif" (so the code will be GetManifestResourceStream(image)) or change the image file name in your project from "EOLogo.gif" to "EOPDFDemo.Images.EOLogo.gif". Either way should get it going for you.
Please keep in mind that we are talking about the sample project itself here ---- if you are talking about copying the code into your own project, then you will need to figure out your own way to load image because obviously your project does not have EOLogo.gif as an embedded resource. It doesn't matter how you load an image, as long as you give a .NET System.Drawing.Image object to our AcmImage object, it will take it.
The other thing you will need to do is if you are working with the sample project, you must remove [Assembly: AllowPartiallyTrustedCallers] from Version.vb. That attribute will cause permission issues for you.
Thanks
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
I am so impressed with the speed of your support! Especially on a weekend! I'll try your solution although its 10.pm over here so it may be tomorrow.
Thanks again
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have posted a new build for this problem. Please see your private message for the download location.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Hi, I thought I'd posted a reply but I can't see it so I'll try again! Thanks for all your help. I am just going through how to output the format I want to confirm it will work for me. I have two issues at the moment.
1) I have a table of 3 columns and 2 rows. I want to put text in the middle columns of both rows so that they are underneath each other. I have done this with no problem but is there a way to centre text within a cell so that the text looks centre justified.
2) I have a table for which I want to show the gridlines. When I invoke the gridlines, they are too "fat" whatever width value I provide. The code is as follows:
'Set the grid line type table.GridLineType = AcmGridLineType.All
'Set the grid line style, color and width table.GridLineInfo = New AcmLineInfo(AcmLineStyle.Solid, System.Drawing.Color.Black, 0.0001F)
table.Style.FontName = "Arial" ' cell1.Style.FontName = "Arial" table.Style.FontSize = 10.0F
table.Rows.Add(row) table.CellPadding = 0.05F
cell2.Style.FontStyle = Font.Italic row.Cells.Add(cell1) row.Cells.Add(cell2) row.Cells.Add(cell3) row.Cells.Add(cell4)
For the ACMLineInfo line, I used 0.01 as in your example and then tried 0.001. They both look the same in the resulting pdf. I tried 1 for interests sake and it was massive but at least I knew that it was the relevant parameter.
3) I lied above because I've just picked up a third issue! I have a row of four cells and I want the second cell to show bold text. The code I have used ("guessed") for this is:
cell2.Style.FontStyle = Font.Bold
It doesn't work, so what am I doing wrong.
Sorry for all these but I need to make sure it does what I need.
Thanks again
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
As to your questions:
1. You would do cell.Style.HorizontalAlign = AcmHorizontalAlign.Center;
2. The unit you specify in the line is in inch (so if you use 1, then it's one inch, that's massive). An inch is usually about 72 or 96 pixels. So 0.01 is about one pixel. So that's about the thinest you can get. If for some reason your line is "fatter" than what's in our sample, then there must be something else. In that case please provide the complete code to reproduce the problem and we will be happy to take a look;
3. The type for cell.Style.FontStyle is "System.Drawing.FontStyle". So you will need to give it "System.Drawing.FontStyle.Bold" (I am not sure where Font.Bold comes from). For the exact type information about each property, you will need to check the reference for that property. That should give you all the information you need to derive the correct syntax;
You may want to take a look of the new HTML to PDF feature if you are also familar with HTML. That's much more powerful and easier to use. Anything you can do with HTML can be rendered out as PDF using our HTML to PDF converter.
Thanks
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Thanks for the feedback. The Font.Bold phrase was my incorrect guess! The lines are to big so I will send you the code I am using probably tomorrow. Thanks again
Adrian
|
|
Rank: Member Groups: Member
Joined: 4/22/2011 Posts: 17
|
Sorry to be a pain but I have a very exact printing requirement. If I send you a scan of a page, could you let me know if it could be done under your software and maybe give me some pointers as to how - I'm not expecting you to do it!! Basically I am trying to create a pdf page which contains a sheet of 8 perforated labels (ordinary paper - non adhesive). Some are images - no problem but some require self contained tables and I am not sure how to create a table on one "label" and then move across and print something else on the next "label". I am hoping I can do something with blocks but I can't find anything in the help file that points me to this.
Thanks
Adrian
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You don't "move" from one cell to another cell like you are holding a pen writing on the paper. You just create a table with each cell having a specific width and height (for example, put a AcmBlock inside each cell and then set that block's width and height).
Thanks
|
|