the SharpPlot command "sp.SavePdf"

General APL language issues

the SharpPlot command "sp.SavePdf"

Postby Leo on Wed Jun 03, 2020 12:08 pm

Hello APL users,
the "Test" program included in the system shows the SharpPlot command in line
[66] sp.SavePdf⊂'D:\DyalogAPL\ws3_Dat\Bezier.pdf '.
This command always worked with WIN 7. Now that I switched to WIN 10, it stopped working.
When I opening "Bezier.pdf" with the Acrobat Reader shows the error message:
"An error occurred while processing a page. There was a problem reading this document (110) “.
The file "Bezier.pdf" is created in Windows Explorer, but with a size of 3KB it is probably empty.
Thank you in advance for suggestions and help!
many Greetings
Leo

PS.: Sorry, I didn't know of any other way to attach the file list!
Test
P0←0,0
P1←0.7,0.6
P2←1,0.1
t←0,0.1×⍳10
x←((1-t)×(1-t)×P0[1])+(2×(1-t)×t×P1[1])+(t×t×P2[1])
y←((1-t)×(1-t)×P0[2])+(2×(1-t)×t×P1[2])+(t×t×P2[2])
'----+----|----+----|----+----|----+----|'
' t x y'
10 3⍕t,x,[1.5]y
⍝'###############################################################################'
⍝ Bezierkurve - Plotprogramm
txt1←'Bezierkurve'
txt2←'2. Grades '
Datum←(2 0⍕⎕TS[3]),'.',(2 0⍕⎕TS[2]),'.',(4 0⍕⎕TS[1])
⍝ ================================================================================
⎕USING←'System.Drawing,system.drawing.dll' 'System.Drawing.Imaging' 'Causeway,sharpplot.dll'
⎕USING,←('Causeway,sharpplot.dll')('CausewayViewer,sharpplot.dll')
⎕USING,←'System.Windows.Forms,System.Windows.Forms.dll' 'System.Drawing,System.Drawing.dll' ''
⍝ ================================================================================

⍝ PaperSize:
sp←⎕NEW Causeway.SharpPlot
sp←⎕NEW Causeway.SharpPlot(800 600) ⍝ X-Wert, Y-Wert
⍝ sp←⎕NEW SharpPlot(PaperSize.Landscape⊂PaperSize.A7) ⍝ DIN A4-Format 298x211 mm

⍝ Äußerer Rahmen
sp.SetFrameBackground System.Drawing.Color.Black Causeway.FillStyle.Solid 0.5
sp.FrameStyle←Causeway.FrameStyles.Boxed
sp.SetMargins 100 100 100 300 ⍝ top - bottom - left - righ (Randabstände)
sp.Gutter←10 ⍝ Abstand Blattrand zu Rahmen

⍝ Chart1 (Line) ==================================================================
sp.Heading←⍕txt1 ⍝ Diagramm-Überschrift
sp.SetHeadingNudge(0,-20) ⍝ Position der Überschrift (horizontal,vertikal)
sp.SetHeadingFont'Arial' 16 System.Drawing.FontStyle.Regular System.Drawing.Color.Black

sp.Subheading←⍕txt2 ⍝ Unter-Überschrift
sp.SetSubheadingFont'Times' 12 System.Drawing.FontStyle.Regular System.Drawing.Color.Black

sp.Footnote←⎕WSID,'.dws Bezierkurve ',Datum,' Ju ' ⍝ Fußnote: Dateipfad, FNS u. Datum
sp.SetFootnoteFont'Arial' 8 System.Drawing.FontStyle.Regular System.Drawing.Color.Black
sp.FootnoteStyle←Causeway.FootnoteStyles.Right ⍝ Fußnote am rechten Rand

⍝ Linienstil der Koordinatenachsen, Liniendicke 0.8:
sp.SetAxisStyle System.Drawing.Color.Black Causeway.LineStyle.Solid 0.8

⍝ Beschreibung und Beschriftungsstil der Achsen:
sp.SetCaptionFont('Arial')(13)(System.Drawing.FontStyle.Regular)(System.Drawing.Color.Red)
sp.XCaption←'X[ - ]' ⍝ Überschrift der X-Achse
sp.YCaption←'Y[ - ]' ⍝ Überschrift der X-Achse
sp.XIntercept←0 ⍝ Schnittpunkt der X-Achse
sp.YIntercept←0 ⍝ Schnittpunkt der Y-Achse
sp.SetXRange(-0.2)(1.2) ⍝ Scalenbereich der X-Achse (Xmin - Xmax)
sp.SetYRange(-0.2)(1.2) ⍝ Scalenbereich der Y-Achse (Ymin - Ymax)
sp.XAxisStyle←Causeway.XAxisStyles.GridLines ⍝ X-Gitterlinien
sp.YAxisStyle←Causeway.YAxisStyles.GridLines ⍝ Y-Gitterlinien

⍝ Schattierung innerhalb des Linienzuges:
sp.SetFillStyles⊂Causeway.FillStyle.(Opacity18) ⍝ Opacity78) ⍝ Innen - Rand
sp.LineGraphStyle←Causeway.LineGraphStyles.(SurfaceShading+Markers)
sp.DrawLineGraph(,⊂y)(x) ⍝ zeichnet Kurve1
sp.DrawLineGraph(,⊂P0[2],P1[2],P2[2])(P0[1],P1[1],P2[1]) ⍝Tangenten
sp.DrawLineGraph(,⊂0.12,0.5)(0.14,0.76)

⍝ - Graphic in *.pdf - write file ----------------------------------------------
sp.SavePdf⊂'D:\DyalogAPL\ws3_Dat\Bezier.pdf'
⍝ - Graphic on screen show -----------------------------------------------------
viewer←⎕NEW SharpPlotViewer ⋄ viewer.SharpPlot←sp ⋄ viewer.
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm

Re: the SharpPlot command "sp.SavePdf"

Postby Vince|Dyalog on Thu Jun 04, 2020 1:28 pm

Hi Leo,

On Windows 10, your code works to create a good PDF for me...

The created PDF is 3.1 Kb and can be seen OK in Foxit PDF Reader 10.0.0.35798

Acrobat DC Reader Version 2020.009.20067

I am using:

Dyalog 17.1.38411.0, 64-bit 17.1 Unicode

sharpplot.dll 3.61.0.0, date modified 15/08/2019

Regards,

Vince
Vince|Dyalog
 
Posts: 412
Joined: Wed Oct 01, 2008 9:39 am

Re: the SharpPlot command "sp.SavePdf"

Postby Leo on Fri Jun 05, 2020 3:08 pm

Hello Vince,
thank you for the fast answer.
I updated DyalogAPL and the AcrobatReader by deinstallation and a new update, but that didn't fix the AcrobatReader error. Only after deleting the two (superfluous) APL statements

sp.SetFillStyles⊂Causeway.FillStyle. (Opacity18) and
sp.LineGraphStyle ← Causeway.LineGraphStyles. (SurfaceShading + Markers)

the AcrobatReader showed the diagram as usual. The AcrobatReader probably has a reservation against shaded areas.
many Greetings
Leo
Leo
 
Posts: 38
Joined: Mon Sep 18, 2017 12:10 pm


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest