1

それを行うライブラリまたはコードはどこかにありますか?

いくつかの質問は、GhostScript を使用して PDF を透明な PNG に変換するようなソフトウェアを示唆しています

プログラムによって行われる何かが必要です。したがって、aspサイトである私のサイトには機能が必要です

function PNGfromPDF (someFile as String) as PNGSomething
end function

そんな感じ。

そのためのオープンソースソリューションはありますか?

4

1 に答える 1

1

試す:

 PdfDocument inputDocument = PdfReader.Open(fileNames[i], PdfDocumentOpenMode.Import);

                        // for each page create a new PDF file and save it on the disk
                        for (int pageCount = 0; pageCount < inputDocument.PageCount; pageCount++)
                        {
    fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileNames[i]);
                                fileName = string.Format("{0}\\Documents\\{1}", Session.CentralWorkingDirectory, String.Format("{0} ({1}-{2}).pdf", fileNameWithoutExtension, pageCount + 1, inputDocument.PageCount));

    pdfFile = PDFFile.Open(fileName);
                pdfFile.SerialNumber = Configurations.PDFVIEW_KEY;

                // Get image file name
                string imageFileName = string.Format("{0}.png", fileName.Remove(fileName.Length - 4));

                // If thumbnail already exists delete it
                if (File.Exists(imageFileName))
                {
                    File.Delete(imageFileName);
                }

                // Convert page to PNG and save it.
                //Bitmap pageImage = pdfFile.GetPageImage(0, 32);


                Bitmap pageImage = pdfFile.GetPageImage(0, 92);
                pageImage.Save(imageFileName, ImageFormat.Png);

                // Cleanup resources
                pageImage.Dispose();
                pdfFile.Dispose();


    }

ここでは、以下の名前空間を使用しています...

using PdfSharp.Drawing;
using O2S.Components.PDFRender4NET; // Thrid party components so you use PDF sharp with this componets
 using System.Drawing.Imaging;
于 2013-11-15T05:34:55.533 に答える