-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a couple of tests showing operations with the library
- Loading branch information
1 parent
f1d94c6
commit eef5f20
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright © Stephen (Sven) Vernyi and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
using QPdfSharp.Options; | ||
|
||
namespace QPdfSharp.Tests; | ||
|
||
public class QPdfExamplesTests | ||
{ | ||
[Fact] | ||
public void Can_read_optimize_write_pdf() | ||
{ | ||
// Read PDF | ||
using var qpdf = new QPdf(TestAssets.Grug); | ||
|
||
// Write with optimizations | ||
qpdf.WriteFile("optimized.pdf", new QPdfWriteOptions | ||
{ | ||
CompressStreams = true, | ||
Linearize = true | ||
}); | ||
} | ||
|
||
[Fact] | ||
public void Can_add_watermark_page_to_pdf() | ||
{ | ||
// This watermark could be safely cached in memory with a long-held reference to QPdf. | ||
using var watermark = new QPdf(TestAssets.QPdfWatermark); | ||
using var qpdf = new QPdf(TestAssets.Grug); | ||
|
||
// Prepend watermark page | ||
qpdf.PrependPage(watermark.GetPage(0)); | ||
|
||
// Write PDF | ||
qpdf.WriteFile("watermarked.pdf"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters