Headers, footers, page numbers and more.zip (49.0 KB)
When using GroupDocs.Conversion v26.1.0, when we attempt to convert the above file, we have noticed that the headers and footers that are present for each page normally when viewing the file are not appearing on each page after conversion.
We are using the following code to reproduce this
[Test]
public async Task Converting_PresentationWithHeadersAndFooters_ShouldHaveHeaderFootersOnAllPages()
{
// Arrange
var filename = "Headers, footers, page numbers and more.pptx";
var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "TestData", "Presentation", filename);
await using var originalDocument = File.Open(path, FileMode.Open);
// Act
using var converter = new Converter(
() => originalDocument,
context =>
{
var loadOptions = new PresentationLoadOptions
{
ShowHiddenSlides = true,
SkipExternalResources = true,
ClearBuiltInDocumentProperties = true,
ClearCustomDocumentProperties = true,
NotesPosition = PresentationNotesPosition.BottomFull,
};
return loadOptions;
});
using var outputStream = new MemoryStream();
var options = new PdfConvertOptions { PdfOptions = new PdfOptions { Linearize = true }, };
converter.Convert(
options,
(ConvertedContext convertedContext) =>
{
convertedContext.ConvertedStream.Position = 0;
convertedContext.ConvertedStream.CopyTo(outputStream);
});
// Copy file to temp directory to examine
var outFilePath = Path.Combine(
Path.GetTempPath(),
$"{Guid.NewGuid()}-{filename}.pdf");
await using var outFile = new FileStream(outFilePath, FileMode.CreateNew);
outputStream.Position = 0;
await outputStream.CopyToAsync(outFile);
}