PDF reports - HiStructClient/femcad-doc GitHub Wiki
PDF images
For pdf images generated by histruct use ImageRenderer
:
imagePdf = Fcs.Presentation.ImageRenderer{
Model = model.Fcm, # model is a gclass of the printed object
DrawSettingsFile = Fcm.GetFileNamePath("CollarCover_Assy.fcsdrs"),
ProjectionSettingsFile = Fcm.GetFileNamePath("CollarCover_Assy.fcsdrv"),
AutoZoom = True,
Padding = 0.01,
LineThicknessMutiplayer = 0.1,
}
You can define the paper size of pdf in the projection settings file (*.fcsdrv) of ImageRenderer
by xSize
and ySize
properties. Standard paper sizes are in the following table, so the dimensions are for paper at portrait orientation, and for landscape orientation, you can swap x and y values. Dimesions are in PostScript points (1/72 inch, always rounded off), conversion formula: Ceil( dimensionInMM * 72 / 25.4 )
.
Paper size | xSize |
ySize |
---|---|---|
A5 | 421 | 595 |
A4 | 595 | 842 |
A3 | 842 | 1190 |
A2 | 1190 | 1684 |
A1 | 1684 | 2380 |
A0 | 2380 | 3368 |
PDF images with template
There are many options have to define template of image. Template is always on the backgroud of the new generated image. For image with template you must use Fcs.Presentation.ImageUpdateRenderer
instead of Fcs.Presentation.ImageRenderer
and set up the TemplateRenderer
or TemplateContent
property, see next examples.
Template from different image:
pdfImageTemplate = Fcs.Presentation.ImageRenderer{
Model = testTemplate.Fcm,
DrawSettingsFile = Fcm.GetFileNamePath("TestTemplate.fcsdrs"),
ProjectionSettingsFile = Fcm.GetFileNamePath("TestTemplate.fcsdrv"),
AutoZoom = True,
Padding = 0.1,
LineThicknessMutiplayer = 0.1,
}
pdfImageWithImageTemplate = Fcs.Presentation.ImageUpdateRenderer{
Model = testArea.Fcm,
DrawSettingsFile = Fcm.GetFileNamePath("TestArea.fcsdrs"),
ProjectionSettingsFile = Fcm.GetFileNamePath("TestArea.fcsdrv"),
AutoZoom = True,
TemplateRenderer = pdfImageTemplate,
}
Template from Telerik report:
telerikReport = Fcs.Reporting.Merge.Template{
TemplatePath = Fcm.GetFileNamePath( "../General/TelerikReportTemplates/A4template.trdx" ),
Content = [{
LeadInfoCompanyName = companyName,
LeadInfoBuildingLocation = buildingLocation,
}]
}
pdfImageWithTelerikTemplate = Fcs.Presentation.ImageUpdateRenderer{
Model = testImageModel.Fcm,
DrawSettingsFile = Fcm.GetFileNamePath("testImageModel.fcsdrs"),
ProjectionSettingsFile = Fcm.GetFileNamePath("testImageModel.fcsdrv"),
AutoZoom = True,
Padding = 0.03,
LineThicknessMutiplayer = 0.1,
TemplateContent = Fcs.Reporting.ContentDefinition.Merge{
Type = "PDF",
Document = telerikReport,
},
}
Template from PDF file:
pdfTemplateFile = Fcs.Reporting.ContentDefinition.File{
Type = "PDF",
Path = Fcm.GetFileNamePath( "../General/A4template.pdf" ),
}
pdfImageWithFileTemplate = Fcs.Presentation.ImageUpdateRenderer{
Model = testImageModel.Fcm,
DrawSettingsFile = Fcm.GetFileNamePath("testImageModel.fcsdrs"),
ProjectionSettingsFile = Fcm.GetFileNamePath("testImageModel.fcsdrv"),
AutoZoom = True,
Padding = 0.03,
LineThicknessMutiplayer = 0.1,
TemplateContent = pdfTemplateFile,
}
PDF Telerik report
There is two ways which you can define telerik pdf report, the old way is definition in reports.fcscdx:
{
"Name": "SummaryReport",
"HumanNameKey": "MainReportsSummaryName",
"DescriptionKey": "MainReportsSummaryDescription",
"TelerikReportTemplateFile": "ProjectSummary.trdx",
"ViewNamesFilter": [ "ViewAxoXposYnegOutput" ]
}
The new was is report definition in fcs files:
telerikReport = Fcs.Reporting.Merge.Template{
TemplatePath = Fcm.GetFileNamePath( "template.trdx" ),
Content = [
Fcs.Reporting.Merge.Value{ Name = "CompanyName", Value = "Testing Company Name" },
Fcs.Reporting.Merge.Value{ Name = "BuildingLocation", Value = "Testing Building Location" },
{
subClass = {
a = 1,
b = 5,
},
},
{
View = {
Image = Fcs.Reporting.ContentDefinition.Image{
Type = "PNG",
Image = myImageRenderer,
},
},
},
Fcs.Reporting.Merge.Table{
Name = "MyTable",
Keys = ["A", "B", "C"],
Rows = [
[ "a1", "b1", "c1" ],
[ "a2", "b2", "c2" ],
[ "a3", "b3", "c3" ],
],
}
]
}