Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.PDF for .NET API permite establecer un nombre de fuente predeterminado cuando una fuente no está disponible en el documento. Puede usar la propiedad DefaultFontName de la clase RenderingOptions para establecer el nombre de fuente predeterminado. En caso de que DefaultFontName se establezca en null, se utilizará la fuente Times New Roman. El siguiente fragmento de código muestra cómo establecer un nombre de fuente predeterminado al guardar un PDF en una imagen:
El siguiente fragmento de código también funciona con la biblioteca Aspose.Drawing.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void ConvertPdfToImageWithDefaultFont()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "PdfToImageWithDefaultFont.pdf"))
{
// Open the image stream
using (var imageStream = new FileStream(dataDir + "SetDefaultFontName.png", FileMode.Create))
{
// Set the resolution for the image
var resolution = new Aspose.Pdf.Devices.Resolution(300);
// Create the PNG device and set rendering options
var pngDevice = new Aspose.Pdf.Devices.PngDevice(resolution);
var ro = new Aspose.Pdf.RenderingOptions
{
DefaultFontName = "Arial"
};
pngDevice.RenderingOptions = ro;
// Process the first page of the document and save it as an image
pngDevice.Process(document.Pages[1], imageStream);
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.