[]
ActiveReportsでは、レポートをPDFドキュメントにエクスポートする際に、基本的な印刷設定をプリセットすることができます。詳細については、PrintPresets クラス プロパティを参照してください。
メモ: PDF印刷プリセットはProfessionalの機能です。Standardで使用する場合、Professionalのライセンスが必要なことを示すバナーが表示されます。 注意: PDF印刷プリセットはPDFバージョン1.7以上で有効になります。PageScalingプロパティのみ、PDFバージョン1.6でサポートされています。
ページレポート、RDLレポート、セクションレポートでは、コードを使用してPDF印刷プリセットのプロパティを設定できます。また、以下のアプリケーションの場合は、[エクスポート]ダイアログからPDF印刷プリセットのプロパティを設定することも可能です。
単体のデザイナ
単体のビューワ(Win/WPF)
エンドユーザーレポートデザイナ
[エクスポート]ダイアログでPDF印刷プリセットを設定する
[エクスポート]ダイアログを開きます。
[ファイル形式]フィールドで、「PDFファイル(PDF)」を選択します。

PrintPresetsノードを展開し、印刷プリセットのプロパティを設定します。
[OK]をクリックしてダイアログを閉じます。
コードでPDF印刷プリセットを設定する
Visual Studioの[ファイル]メニューから、[新規作成]を選択し、[プロジェクト]を選択します。
[新しいプロジェクト]ダイアログで、任意の言語の下から[Reporting]ノードをクリックします。
追加したいレポートアプリケーションを選択します(レポート種類と特徴については「レポートの種類」を参照してください):
ActiveReports 20 ページレポートアプリケーション
ActiveReports 20 RDLレポートアプリケーション
ActiveReports 20 セクションレポートアプリケーション(XML)
[名前]フィールドで、レポートアプリケーションの名前を入力し、[OK]をクリックします。選択されたレポートの種類がプロジェクトへ追加されます。
フォームのタイトルバーをダブルクリックしてForm_Loadイベントを作成します。
ハンドラに次のコードを追加し、Exportメソッドを呼び出して印刷プリセットを設定します。
セクションレポート
Dim sectionReport As New GrapeCity.ActiveReports.SectionReport()
Dim xtr As New System.Xml.XmlTextReader(Application.StartupPath + "\..\..\SectionReport1.rpx")
sectionReport.LoadLayout(xtr)
sectionReport.Run()
'PDF用の設定を定義します。
Dim p As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport()
p.Version = GrapeCity.ActiveReports.Export.Pdf.Section.PdfVersion.Pdf17
'PrinPresetsクラスを使用してデフォルトの印刷設定を設定します。
p.PrintPresets.PageScaling = GrapeCity.ActiveReports.Export.Pdf.Enums.PageScaling.None
p.PrintPresets.DuplexMode = GrapeCity.ActiveReports.Export.Pdf.Enums.DuplexMode.DuplexFlipLongEdge
p.PrintPresets.NumberOfCopies = GrapeCity.ActiveReports.Export.Pdf.Enums.NumberOfCopies.Two
p.PrintPresets.PaperSourceByPageSize = True
p.PrintPresets.PrintPageRange = "1-3"
p.Export(sectionReport.Document, Application.StartupPath + "\PrintPresets.pdf")GrapeCity.ActiveReports.SectionReport sectionReport = new GrapeCity.ActiveReports.SectionReport();
System.Xml.XmlTextReader xtr = new System.Xml.XmlTextReader(Application.StartupPath + @"\..\..\SectionReport1.rpx");
sectionReport.LoadLayout(xtr);
sectionReport.Run();
//PDF用の設定を定義します。
GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport p = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
p.Version = GrapeCity.ActiveReports.Export.Pdf.Section.PdfVersion.Pdf17;
//PrinPresetsクラスを使用してデフォルトの印刷設定を設定します。
p.PrintPresets.PageScaling = GrapeCity.ActiveReports.Export.Pdf.Enums.PageScaling.None;
p.PrintPresets.DuplexMode = GrapeCity.ActiveReports.Export.Pdf.Enums.DuplexMode.DuplexFlipLongEdge;
p.PrintPresets.NumberOfCopies = GrapeCity.ActiveReports.Export.Pdf.Enums.NumberOfCopies.Two;
p.PrintPresets.PaperSourceByPageSize = true;
p.PrintPresets.PrintPageRange = "1-3";
p.Export(sectionReport.Document, Application.StartupPath + "\\PrintPresets.pdf");ページレポートまたはRDLレポート
'RenderingExtensionを設定し、レポートをエクスポートします。
Dim pdfExport = New GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension()
'PDF用の設定を定義します。
Dim pdfSettings As New GrapeCity.ActiveReports.Export.Pdf.Page.Settings()
pdfSettings.Version = GrapeCity.ActiveReports.Export.Pdf.Page.PdfVersion.Pdf17
pdfSettings.PrintOnOpen = True
'PrinPresetsクラスを使用してデフォルトの印刷設定を設定します。
Dim pdfPresetsSetting As New GrapeCity.ActiveReports.Export.Pdf.PrintPresets()
pdfPresetsSetting.PageScaling = GrapeCity.ActiveReports.Export.Pdf.Enums.PageScaling.None
pdfPresetsSetting.DuplexMode = GrapeCity.ActiveReports.Export.Pdf.Enums.DuplexMode.DuplexFlipLongEdge
pdfPresetsSetting.NumberOfCopies = GrapeCity.ActiveReports.Export.Pdf.Enums.NumberOfCopies.Two
pdfPresetsSetting.PaperSourceByPageSize = True
pdfPresetsSetting.PrintPageRange = "1-3"
pdfSettings.PrintPresets = pdfPresetsSetting
Dim outputFile = New IO.FileInfo("..\..\PrintPresets.pdf")
Dim reportFile = New IO.FileInfo("..\..\PageReport1.rdlx")
Dim fileStreamProvider = New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputFile.Directory, System.IO.Path.GetFileNameWithoutExtension(outputFile.FullName))
Using pageDocument = New GrapeCity.ActiveReports.PageReport(reportFile).Document
pageDocument.Render(pdfExport, fileStreamProvider, pdfSettings)
End Using//RenderingExtensionを設定し、レポートをエクスポートします。
var pdfExport = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
//PDF用の設定を定義します。
GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSettings = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
pdfSettings.Version = GrapeCity.ActiveReports.Export.Pdf.Page.PdfVersion.Pdf17;
pdfSettings.PrintOnOpen = true;
//PrinPresetsクラスを使用してデフォルトの印刷設定を設定します。
GrapeCity.ActiveReports.Export.Pdf.PrintPresets pdfPresetsSetting = new GrapeCity.ActiveReports.Export.Pdf.PrintPresets();
pdfPresetsSetting.PageScaling = GrapeCity.ActiveReports.Export.Pdf.Enums.PageScaling.None;
pdfPresetsSetting.DuplexMode = GrapeCity.ActiveReports.Export.Pdf.Enums.DuplexMode.DuplexFlipLongEdge;
pdfPresetsSetting.NumberOfCopies = GrapeCity.ActiveReports.Export.Pdf.Enums.NumberOfCopies.Two;
pdfPresetsSetting.PaperSourceByPageSize = true;
pdfPresetsSetting.PrintPageRange = "1-3";
pdfSettings.PrintPresets = pdfPresetsSetting;
var outputFile = new System.IO.FileInfo(@"..\..\PrintPresets.pdf");
var reportFile = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
var fileStreamProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputFile.Directory,
System.IO.Path.GetFileNameWithoutExtension(outputFile.FullName));
using (var pageDocument = new GrapeCity.ActiveReports.PageReport(reportFile).Document)
{
pageDocument.Render(pdfExport, fileStreamProvider, pdfSettings);
}