|
10 | 10 | using System.Linq; |
11 | 11 | using System.Threading; |
12 | 12 | using PaintDotNet; |
| 13 | +using PaintDotNet.PropertySystem; |
13 | 14 | using PaintDotNet.Rendering; |
14 | 15 |
|
15 | 16 | namespace PdfFileTypePlugin.Export |
@@ -52,12 +53,16 @@ protected PdfExporter(Document input, Stream output, PropertyBasedSaveConfigToke |
52 | 53 | ScratchSurface = scratchSurface; |
53 | 54 | progress = progressCallback; |
54 | 55 |
|
55 | | - Quality = token.GetInt32PropertyValue(PropertyNames.Quality); |
56 | | - SkipHiddenLayers = token.GetBooleanPropertyValue(PropertyNames.SkipInvisibleLayers); |
57 | | - SkipDuplicateLayers = token.GetBooleanPropertyValue(PropertyNames.SkipDuplicateLayers); |
58 | | - PdfStd = (PdfStandard)token.GetStaticListChoicePropertyValue(PropertyNames.PdfStandard); |
59 | | - Mode = (ExportMode)token.GetStaticListChoicePropertyValue(PropertyNames.ExportMode); |
60 | | - EmbedProperties = token.GetBooleanPropertyValue(PropertyNames.EmbedProperties) && (Mode == ExportMode.Cropped || Mode == ExportMode.Normal); |
| 56 | + PropertyCollection props = token.Properties; |
| 57 | + |
| 58 | +#pragma warning disable format // @formatter:off |
| 59 | + Quality = props.GetPropertyValue<int>(PropertyNames.Quality); |
| 60 | + SkipHiddenLayers = props.GetPropertyValue<bool>(PropertyNames.SkipInvisibleLayers); |
| 61 | + SkipDuplicateLayers = props.GetPropertyValue<bool>(PropertyNames.SkipDuplicateLayers); |
| 62 | + PdfStd = props.GetPropertyValue<PdfStandard>(PropertyNames.PdfStandard); |
| 63 | + Mode = props.GetPropertyValue<ExportMode>(PropertyNames.ExportMode); |
| 64 | + EmbedProperties = props.GetPropertyValue<bool>(PropertyNames.EmbedProperties) && (Mode == ExportMode.Cropped || Mode == ExportMode.Normal); |
| 65 | +#pragma warning restore format // @formatter:on |
61 | 66 |
|
62 | 67 | if (EmbedProperties) |
63 | 68 | { |
@@ -164,7 +169,8 @@ protected MemoryStream EncodeLossless(Bitmap bmp) |
164 | 169 |
|
165 | 170 | public static PdfExporter Create(Document input, Stream output, PropertyBasedSaveConfigToken token, Surface scratchSurface, ProgressEventHandler progressCallback) |
166 | 171 | { |
167 | | - PdfStandard std = (PdfStandard)token.GetStaticListChoicePropertyValue(PropertyNames.PdfStandard); |
| 172 | + PropertyCollection props = token.Properties; |
| 173 | + PdfStandard std = props.GetPropertyValue<PdfStandard>(PropertyNames.PdfStandard); |
168 | 174 | return std == PdfStandard.None |
169 | 175 | #pragma warning disable IDE0004 |
170 | 176 | ? (PdfExporter)new PdfiumExporter(input, output, token, scratchSurface, progressCallback) |
|
0 commit comments