WritePro Unterschiedliche Hintergründe

Ich scheitere gerade daran, in ein 4D Write Dokument auf der ersten Seite und den Folgeseiten unterschiedliche Hintergrundbilder einzusetzen.

<code 4D>
INVOKE ACTION(“section/differentFirstPage”;ak current form)
READ PICTURE FILE(Get 4D folder(Current resources folder)+“picts”+Folder separator+“Briefkopf_Seite1.pdf”;$pict_pi)
$section_o:=WP Get section([Brief]WP_Dokument;1)
WP SET ATTRIBUTES($section_o;wk background image;$pict_pi)
$fp_o:=WP Get subsection($section_o;wk first page)
WP SET ATTRIBUTES($fp_o;wk background image;$pict_pi)
WP SET ATTRIBUTES($fp_o;wk background clip;wk paper box)
WP SET ATTRIBUTES($fp_o;wk background origin;wk paper box)
WP SET ATTRIBUTES($fp_o;wk background height;“100%”)
WP SET ATTRIBUTES($fp_o;wk background width;“100%”)

</code 4D>

Damit ist das erste Bild auf allen Seiten, auf Seiten 2+ allerdings nicht in der richtigen Größe.
Wie setze ich Bild1 in Seite 1 und Bild2 in die restlichen Seiten?

Und: lässt sich die Krücke INVOKE ACTION(“section/differentFirstPage”;ak current form) inzwischen umgehen?

Geht ganz ohne Sections:

<code 4D>
C_OBJECT($1;$WPobj;$wprange;$wprange2;$obj_path)
C_TEXT($2;$PDFpath;vt_MacPDFPage1;vt_MacPDFPage2)
$PDFpath:=$2
$WPobj:=OB Copy($1)

WP SET ATTRIBUTES($WPobj;wk background color;wk transparent)
$obj_path:=Path to object($PDFpath)
SET PRINT OPTION(Spooler document name option;$obj_path.name+$obj_path.extension)
SET PRINT OPTION(Destination option;3;$PDFpath)

C_LONGINT($wr_Pages_L;$x_L;$y_L;$loop)

C_TEXT(vt_MacPDFPage1;vt_MacPDFPage2)
C_PICTURE($pdfBackground_B;$pdfBackground_2)
C_REAL($vr_width;$vr_height;$vr_diffFirst;$vr_diffLeftRight)
$wr_Pages_L:=WP Get page count($WPobj)
$x_L:=0
$y_L:=0
If (vt_MacPDFPage1#"")
If (Test path name(vt_MacPDFPage1)=Is a document)
Case of
: ($wr_Pages_L=1) | (vt_MacPDFPage2="")
$wprange:=WP Add picture($WPobj;vt_MacPDFPage1)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)

			WP SET ATTRIBUTES($wprange;wk anchor page;1)  //wk anchor first page)
			WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
			WP SET ATTRIBUTES($wprange;wk width;$WPobj.pagewidth)
		: (vt_MacPDFPage2#"") & (vt_MacPDFPage1#vt_MacPDFPage2)
			
			If (Test path name(vt_MacPDFPage2)=Is a document)
				For ($loop;2;$wr_Pages_L)
					$wprange2:=WP Add picture($WPobj;vt_MacPDFPage2)
					WP SET ATTRIBUTES($wprange2;wk anchor layout;wk behind text)
					WP SET ATTRIBUTES($wprange2;wk anchor page;$loop)  //wk anchor first page)
					WP SET ATTRIBUTES($wprange2;wk anchor origin;wk paper box)
					WP SET ATTRIBUTES($wprange2;wk width;$WPobj.pagewidth)
				End for 
			End if 
			$wprange:=WP Add picture($WPobj;vt_MacPDFPage1)
			WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
			WP SET ATTRIBUTES($wprange;wk anchor page;1)  //wk anchor first page)
			WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
			WP SET ATTRIBUTES($wprange;wk width;$WPobj.pagewidth)
		: (vt_MacPDFPage2#"") & (vt_MacPDFPage1=vt_MacPDFPage2)
			$wprange:=WP Add picture($WPobj;vt_MacPDFPage1)
			WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
			WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor all)
			WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
			WP SET ATTRIBUTES($wprange;wk width;$WPobj.pagewidth)
			
	End case 
End if 

End if
WP PRINT($WPobj)
SET PRINT OPTION(Destination option;0;"")
SET PRINT OPTION(Spooler document name option;"")
</code 4D>

Danke - wenn der Briefkopf nur beim Drucken eingesetzt werden soll, geht es so.

Falls der Briefkopf aber mit ins Dokument soll ist es problematisch, da immer wenn eine neue Seite entsteht der Briefkopf wieder eingesetzt werden muss. Daher die Idee mit dem Hintergrundbild, unterschiedlich auf Seite 1 und den folgenden.

Markus,

ich habe es nicht ausgetestet, Du kannst das aber mal als Basis zum Testen nehmen:

<code 4D>
$wpSection:=WP Get sections(WParea)
If ($wpSection.length=1)
$section:=WP Get section(WParea;1)

$subsection:=WP New subsection($section;wk first page)
$subsection:=WP New subsection($section;wk left page)

$section:=WP Get section(WParea;1)
$wprange:=WP Add picture($section;vt_MacPDFPage1)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor first page)
WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($wprange;wk width;$section.pagewidth)

$subsection:=WP Get subsection($section;wk left page)
$wprange:=WP Add picture($subsection;vt_MacPDFPage2)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor left page)
WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($wprange;wk width;$subsection.pagewidth)

$subsection:=WP Get subsection($section;wk right page)
$wprange:=WP Add picture($subsection;vt_MacPDFPage2)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor right page)
WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($wprange;wk width;$subsection.pagewidth)
end if

</code 4D>
Armin

So ausgetestet, damit geht es:

<code 4D>
vt_MacPDFPage1:=“Macintosh HD:Users:armindeeg:Desktop:brief1.pdf”
vt_MacPDFPage2:=“Macintosh HD:Users:armindeeg:Desktop:brief2.pdf”

if(OB Get(WParea;“MarkusLogos”;Is text)#“Drin”)
$section:=WP Get section(WParea;1)

$subsection:=WP Get subsection($section;wk first page)
If ($subsection=Null)
	$subsection:=WP New subsection($section;wk first page)
end if
$wprange:=WP Add picture(WParea;vt_MacPDFPage1)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor first page)
WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($wprange;wk width;WParea.pageWidth)
WP SET ATTRIBUTES($wprange;wk height;WParea.pageHeight)
WP SET ATTRIBUTES($wprange;wk anchor section;1)

$subsection:=WP Get subsection($section;wk left page)
If ($subsection=Null)
	$subsection:=WP New subsection($section;wk left page)
end if
$wprange:=WP Add picture(WParea;vt_MacPDFPage2)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor left page)
WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($wprange;wk width;WParea.pageWidth)
WP SET ATTRIBUTES($wprange;wk height;WParea.pageHeight)
WP SET ATTRIBUTES($wprange;wk anchor section;1)

$subsection:=WP Get subsection($section;wk right page)
If ($subsection=Null)
	$subsection:=WP New subsection($section;wk right page)
end if
$wprange:=WP Add picture(WParea;vt_MacPDFPage2)
WP SET ATTRIBUTES($wprange;wk anchor layout;wk behind text)
WP SET ATTRIBUTES($wprange;wk anchor page;wk anchor right page)
WP SET ATTRIBUTES($wprange;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($wprange;wk width;WParea.pageWidth)
WP SET ATTRIBUTES($wprange;wk height;WParea.pageHeight)
WP SET ATTRIBUTES($wprange;wk anchor section;1)

//Marker damit das nicht doppelt gemacht wird
OB SET(WParea;"MarkusLogos";"Drin")

end if
</code 4D>

Armin

Super, danke!