/** * <summary>Begins a content row.</summary> */ private void BeginRow( ) { rowEnded = false; ContentScanner.GraphicsState state = baseComposer.State; double rowY = boundBox.Height; if (rowY > 0) { rowY += lineSpace.GetValue(state.Font != null ? state.Font.GetLineHeight(state.FontSize) : 0); } currentRow = new Row(rowY); if (xAlignment == XAlignmentEnum.Justify) { /* * TODO: This temporary hack forces PrimitiveComposer.showText() to insert word space * adjustments in case of justified text; when the row ends, it has to be updated with the * actual adjustment value. */ currentRow.WordSpaceAdjustment = baseComposer.Add(new SetWordSpace(.001)); } else if (state.WordSpace != 0) { baseComposer.SetWordSpace(0); } }
/** * Begins a content row. */ private void BeginRow( ) { rowEnded = false; float rowY = boundBox.Height; if (rowY > 0) { ContentScanner.GraphicsState state = baseComposer.State; rowY += lineSpace.GetValue(state.Font.GetLineHeight(state.FontSize)); } currentRow = new Row( (ContentPlaceholder)baseComposer.Add(new ContentPlaceholder()), rowY ); }
public override ContentObject ToInlineObject(PrimitiveComposer composer) { return(composer.Add( new InlineImage( new InlineImageHeader( new List <PdfDirectObject>( new PdfDirectObject[] { PdfName.W, PdfInteger.Get(Width), PdfName.H, PdfInteger.Get(Height), PdfName.CS, PdfName.RGB, PdfName.BPC, PdfInteger.Get(BitsPerComponent), PdfName.F, PdfName.DCT } ) ), new InlineImageBody( new bytes::Buffer(Stream) ) ) )); }
public override ContentObject ToInlineObject( PrimitiveComposer composer ) { return composer.Add( new InlineImage( new InlineImageHeader( new List<PdfDirectObject>( new PdfDirectObject[] { PdfName.W, PdfInteger.Get(Width), PdfName.H, PdfInteger.Get(Height), PdfName.CS, PdfName.RGB, PdfName.BPC, PdfInteger.Get(BitsPerComponent), PdfName.F, PdfName.DCT } ) ), new InlineImageBody( new bytes::Buffer(Stream) ) ) ); }
private void BuildSteps( PrimitiveComposer composer, string[] steps, colorSpaces::Color[] colors, SizeF pageSize ) { composer.SetFont(ResourceName_DefaultFont,32); RectangleF frame = new RectangleF( 0, 0, pageSize.Width, pageSize.Height ); // Step 0. { colors[0] = new colorSpaces::DeviceRGBColor(30 / 255d, 10 / 255d, 0); composer.SetFillColor(colors[0]); composer.SetStrokeColor(colors[0]); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 0", new PointF(0,pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[0] = GetStepNote(composer,"default"); } // Step 1. { colors[1] = new colorSpaces::DeviceRGBColor(80 / 255d, 25 / 255d, 0); composer.SetFillColor(colors[1]); composer.SetStrokeColor(colors[1]); // Transform the coordinate space, applying translation! composer.Translate(72,72); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 1", new PointF(0,pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[1] = GetStepNote(composer,"after translate(72,72)"); } // Step 2. { colors[2] = new colorSpaces::DeviceRGBColor(130 / 255d, 45 / 255d, 0); composer.SetFillColor(colors[2]); composer.SetStrokeColor(colors[2]); // Transform the coordinate space, applying clockwise rotation! composer.Rotate(-20); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the coordinate space origin mark! composer.ShowText("Origin 2"); // Draw the lower-left corner mark! composer.ShowText( "Step 2", new PointF(0,pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[2] = GetStepNote(composer,"after rotate(20)"); } // Step 3. { colors[3] = new colorSpaces::DeviceRGBColor(180 / 255d, 60 / 255d, 0); composer.SetFillColor(colors[3]); composer.SetStrokeColor(colors[3]); // Transform the coordinate space, applying translation and scaling! composer.Translate(0,72); composer.Scale(.5f,.5f); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 3", new PointF(0,pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[3] = GetStepNote(composer,"after translate(0,72) and scale(.5,.5)"); } // Step 4. { colors[4] = new colorSpaces::DeviceRGBColor(230 / 255d, 75 / 255d, 0); composer.SetFillColor(colors[4]); composer.SetStrokeColor(colors[4]); // Transform the coordinate space, restoring its initial CTM! composer.Add( ModifyCTM.GetResetCTM( composer.Scanner.State ) ); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 4", new PointF(0,pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[4] = GetStepNote(composer,"after resetting CTM"); } }
private void BuildSteps( PrimitiveComposer composer, string[] steps, colorSpaces::Color[] colors, SKSize pageSize ) { composer.SetFont(ResourceName_DefaultFont, 32); SKRect frame = SKRect.Create( 0, 0, pageSize.Width, pageSize.Height ); // Step 0. { colors[0] = new colorSpaces::DeviceRGBColor(30 / 255d, 10 / 255d, 0); composer.SetFillColor(colors[0]); composer.SetStrokeColor(colors[0]); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 0", new SKPoint(0, pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[0] = GetStepNote(composer, "default"); } // Step 1. { colors[1] = new colorSpaces::DeviceRGBColor(80 / 255d, 25 / 255d, 0); composer.SetFillColor(colors[1]); composer.SetStrokeColor(colors[1]); // Transform the coordinate space, applying translation! composer.Translate(72, 72); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 1", new SKPoint(0, pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[1] = GetStepNote(composer, "after translate(72,72)"); } // Step 2. { colors[2] = new colorSpaces::DeviceRGBColor(130 / 255d, 45 / 255d, 0); composer.SetFillColor(colors[2]); composer.SetStrokeColor(colors[2]); // Transform the coordinate space, applying clockwise rotation! composer.Rotate(-20); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the coordinate space origin mark! composer.ShowText("Origin 2"); // Draw the lower-left corner mark! composer.ShowText( "Step 2", new SKPoint(0, pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[2] = GetStepNote(composer, "after rotate(20)"); } // Step 3. { colors[3] = new colorSpaces::DeviceRGBColor(180 / 255d, 60 / 255d, 0); composer.SetFillColor(colors[3]); composer.SetStrokeColor(colors[3]); // Transform the coordinate space, applying translation and scaling! composer.Translate(0, 72); composer.Scale(.5f, .5f); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 3", new SKPoint(0, pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[3] = GetStepNote(composer, "after translate(0,72) and scale(.5,.5)"); } // Step 4. { colors[4] = new colorSpaces::DeviceRGBColor(230 / 255d, 75 / 255d, 0); composer.SetFillColor(colors[4]); composer.SetStrokeColor(colors[4]); // Transform the coordinate space, restoring its initial CTM! composer.Add( ModifyCTM.GetResetCTM( composer.Scanner.State ) ); // Draw the page frame! composer.DrawRectangle(frame); composer.Stroke(); // Draw the lower-left corner mark! composer.ShowText( "Step 4", new SKPoint(0, pageSize.Height), XAlignmentEnum.Left, YAlignmentEnum.Bottom, 0 ); steps[4] = GetStepNote(composer, "after resetting CTM"); } }