 |
|
 |
I noticed most of the questions about this subject matter are about methodology and logic rather than functionality. Check out the official website for PDFsharp, there are multiple examples and help for the source code and library which are downloadable.
Dagdason
http://www.pdfsharp.net/wiki/MainPage.ashx
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Good advice. Maybe I should also update the article, because since it was published the PDFSharp website and forum have moved.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello,
I used the appliation and it is running excellent but I my project need to convert more than one image file to one PDF file can anyone help me in that.
Thanks,
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Here is my code for a TIFF file with multiple images
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { string source = (e.Argument as string[])[0]; string destinaton = (e.Argument as string[])[1];
PdfDocument doc = new PdfDocument(); Image myimage = Image.FromFile(source);
System.Drawing.Imaging.FrameDimension oFDimension = new System.Drawing.Imaging.FrameDimension(myimage.FrameDimensionsList[0]); int iCount = myimage.GetFrameCount(oFDimension) - 1;
for (int index = 0; index <= (iCount); index++) { PdfPage page = doc.AddPage(); page.Size = PageSize.Letter; page.Orientation = PageOrientation.Portrait; XGraphics xgr = XGraphics.FromPdfPage(page); myimage.SelectActiveFrame(oFDimension, index); XImage img = XImage.FromGdiPlusImage(myimage); xgr.DrawImage(img, 0, 0); }
// XImage img = XImage.FromFile(source);
// xgr.DrawImage(img, 0, 0); doc.Save(destinaton); doc.Close(); success = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
hi..all,
We are going to make PDF file from image tiff. Also we have co-ordinate information of the text. Now we want to hide the text in specified position. Is this dll has facility to hide the text in specified position?
Is there is any dll available for that..i am using itextsharp buts its not working.
Please Help me..
any example would be appreciated..
Thanks, Raj
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hello ,
I am using to merge multiple PDF to Single Pdf.
for that purpose i am using pdfsharp..its working fine but when i see the properties of that merge pdf his fast web view is False.
while all PDF fast web view properties is TRUE. after merging its become False.
so how i fix this problem...anyone help me...
here is my code...
private void CreatePDF() { // Get some file names if (GetFiles().Length == 0) { MessageBox.Show("NO PDF Files Found in the Directory"); } else { FileInfo[] files = GetFiles();
// Open the output document PdfDocument outputDocument = new PdfDocument();
// Iterate files foreach (FileInfo file in files) { // Open the document to import pages from it.
try { PdfDocument inputDocument = PdfReader.Open(file.FullName, PdfDocumentOpenMode.Import); // Iterate pages int count = inputDocument.PageCount; for (int idx = 0; idx < count; idx++) { // Get the page from the external document... PdfPage page = inputDocument.Pages[idx]; // ...and add it to the output document. outputDocument.AddPage(page); outputDocument.ViewerPreferences.Clone(); }
logger.log("Completed Processing " + file.Name); } catch (Exception ex) { //MessageBox.Show(ex.Message); logger.log(ex.Message + " error occured while processing " + file.Name); } }
// Save the document... string filename = txtOut.Text; outputDocument.Save(filename); MessageBox.Show("Files are merged successfully"); // ...and start a viewer. Process.Start(filename); } }
so Please help me...!
Thanks, Raj
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Have you tried asking this on the PDFSharp forum? My experience with this library is limited to the topic of this article, but on the official forum[^] you would have better chances to get help.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
This is a great program. But only converts 1 page of a multipage TIFF file. Apparently it will do on multipage tiff file also.
Give me some ideas on that.
Thank You
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
private void bw_DoWork(object sender, DoWorkEventArgs e) { try { string source = (e.Argument as string[])[0]; string destinaton = (e.Argument as string[])[1];
PdfDocument doc = new PdfDocument(); Image myimage = Image.FromFile(source);
System.Drawing.Imaging.FrameDimension oFDimension = new System.Drawing.Imaging.FrameDimension(myimage.FrameDimensionsList[0]); int iCount = myimage.GetFrameCount(oFDimension) - 1;
for (int index = 0; index <= (iCount); index++) { PdfPage page = doc.AddPage(); page.Size = PageSize.Letter; page.Orientation = PageOrientation.Portrait; XGraphics xgr = XGraphics.FromPdfPage(page); myimage.SelectActiveFrame(oFDimension, index); XImage img = XImage.FromGdiPlusImage(myimage); xgr.DrawImage(img, 0, 0); }
// XImage img = XImage.FromFile(source);
// xgr.DrawImage(img, 0, 0); doc.Save(destinaton); doc.Close(); success = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
 |
Does anyone know if PDFSharp can export images in a PDF file, more specifically the first image (the cover)? I can do it with ghost script but its such a hassle having to install gs and run this long ass command for each PDF file:
gswin32c.exe -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dUseCropBox -dMaxBitmap=500000000 -dFirstPage=1 -dLastPage=1 -dAlignToPixels=0 -dGridFitTT=0 -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r100x100 -sOutputFile=output.jpg "Y:\EBooks\Computer\Programming\Perl\(2002) OReilly - Perl and XML.pdf"
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
As far as I know, PDF Sharp can only create PDF files, and not open existing ones. A thing I needed a while ago was to extract the plain text from a PDF file. For that I needed a library which could use PDF files as input. I found the solution to be PDF Box. It might also help you to take the images. Check it out. However, this too is not hassle free, as you must add dll files which sum up to about 15 MB. (IKVM, because PDF Box is originally a Java library) I remember seeing an article on this here on CP, too. Hope this helps. Good luck!
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Wow, you're right 15MB certainly is a liability for a single call to a PDF file (GetBookCover routine). Thanks for the tip though, I will bookmark it for future use if I need to d more with PDF files.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hi,
I want to save the image(small as well as large image) in center of the pdf page. How can I do that?
Please suggest some idea.
Thank You
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
You can set the size of the PDF page using the properties "doc.Pages[0].Width" and "doc.Pages[0].Height". Do the calculations on where you want the image to be put, and instead of drawing it at coordinates (0,0), draw it at the coordinates that you came up with.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
An Exception occured when converting BMP to PDF as following:
NotImplementedException: Image format not supported. at PdfSharp.Pdf.Advanced.PdfImage.InitializeNonJpeg() at PdfSharp.Pdf.Advanced.PdfImage..ctor(PdfDocument document, XImage image) at PdfSharp.Pdf.Advanced.PdfImageTable.GetImage(XImage image) at PdfSharp.Pdf.PdfPage.GetImageName(XImage image) at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.GetImageName(XImage image) at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.Realize(XImage image) at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.DrawImage(XImage image, Double x, Double y, Double width, Double height) at PdfSharp.Drawing.XGraphics.DrawImage(XImage image, Double x, Double y) at PdfSharp.Drawing.XGraphics.DrawImage(XImage image, Int32 x, Int32 y)
What's the problem?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
Hmmm... this never happened on my BMP files. Maybe your image is in another fancy format with incorrect BMP extension... If you have a sample image to demonstrate this, you can send it to me by email. Just add '@gmail.com' after my user name. Or it might just be a bug in PDFSharp, in which case we'll have to look on their forum for help. Regards.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
 |
Hi blackjack2150,
I had sent the email attached the BMP to your mailbox,blackjack2150@gmail.com. Please have a check and verify what's the reason is?
Your help will benifit me a lot.
Thank you very much.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
 |
hiiiiii, how to convert a pdf file to image file in c#.net? Its an immediate requirement,plz help me out !!!!!
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
 |
As far as I know, PDFSharp is only for creating PDF files, not for reading information or converting existing PDF files.
For your need, I think you should look for a Virtual printer that can output image files. One that I know of is Bullzip PDF Printer. Most of the time it is used to produce PDF files, but there is also the option to choose and image format instead of PDF.
Insert funny quote here.
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
 |
Hi all.
I have an little apps in vb.net to trasform tiff-ccit4 on pdf.
Using itextsharp it's very slow (30kb tiff --> 30sec on pdf conversion) Using pdflib work fast but i have incompatibility with another apps that use itextsharp.
It's possible to use your project on vb.net? If yes, how?
Im newbee and sorry for my english
Best regards
modified on Tuesday, December 16, 2008 1:41 PM
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
 |
Of course it is. Just add a reference to PdfSharp.dll and use the code in the article in the VB.NET equivalent.
Insert funny quote here.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |