Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
次のコードスニペットは、Aspose.PDF.Drawingライブラリでも動作します。
ドキュメントを開く方法はいくつかあります。最も簡単なのは、ファイル名を指定することです。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void OpenDocument()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_QuickStart();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "tourguidev2_gb_tags.pdf"))
{
Console.WriteLine("Pages " + document.Pages.Count);
}
}
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void OpenDocumentStream()
{
var fileName = "SJPR0033_Folder_Utland_16sid_ENG_web3.pdf";
var remoteUri = "https://www.sj.se/content/dam/SJ/pdf/Engelska/";
// Create a new WebClient instance
var webClient = new System.Net.WebClient();
// Concatenate the domain with the Web resource filename
var strWebResource = remoteUri + fileName;
Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, strWebResource);
var stream = new MemoryStream();
webClient.OpenRead(strWebResource)?.CopyTo(stream);
// Open PDF document
using (var document = new Aspose.Pdf.Document(stream))
{
Console.WriteLine("Pages " + document.Pages.Count);
}
}
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void OpenDocumentWithPassword()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_QuickStart();
const string password = "Aspose2020";
try
{
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "DocSite.pdf", password))
{
Console.WriteLine("Pages " + document.Pages.Count);
}
}
catch (Aspose.Pdf.InvalidPasswordException e)
{
Console.WriteLine(e);
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.