PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Mar 29, 2024 4:00 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Feb 05, 2020 7:20 pm 
Offline

Joined: Wed Feb 05, 2020 6:58 pm
Posts: 3
I am using c# ASP.NET, I want to convert pdf file to tiff or png. I did it using ImageMagick but it is slow. I don't know how to do it using PDFsharp and couldn't find any samples online.
This code scan the file extract each page then convert each page to tif file. Can anyone show me how its done using PDFsharp. Is it any faster from your experience. Tank you.
Code:
MagickReadSettings settings = new MagickReadSettings();
            // Settings the density to 300 dpi will create an image with a better quality
            settings.Density = new Density(300);

            using (MagickImageCollection images = new MagickImageCollection())
            {
                // Add all the pages of the pdf file to the collection
                images.Read(fileName, settings);

                int page = 1;
                foreach (MagickImage image in images)
                {
                    // Write page to file that contains the page Number
                    //image.Write(@"C:\Users\syousif\Desktop\pdfconverttes\Snakeware.png" + page + ".png");
                    // Writing to a specific format works the same as for a single image
                    image.Format = MagickFormat.Png;
                    image.Write(fileNameResultDirectory + "\\0" + page + ".Png");
                    page++;
                }
            }


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 05, 2020 7:48 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Read a lot, learn a lot.
FAQ #3:
http://www.pdfsharp.net/wiki/PDFsharpFA ... DF_files_3

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 05, 2020 8:06 pm 
Offline

Joined: Wed Feb 05, 2020 6:58 pm
Posts: 3
TH-Soft wrote:


I saw this in my research, is this long way for saying it can't be done :(


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 06, 2020 7:26 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
AskAlotLearnAlot wrote:
I saw this in my research, is this long way for saying it can't be done :(
PDFsharp is open source. It can be done, but I assume you do not have the time to implement it. And the rendering part is completely missing in PDFsharp.

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 06, 2020 1:58 pm 
Offline

Joined: Wed Feb 05, 2020 6:58 pm
Posts: 3
Mainly the experience. Thank you for the response.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 179 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group