i need create Underline, Squiggly, or StrikeOut annotation with multiline.

[<img style="" src="https://lh3.googleusercontent.com/-vpFU7b3eS9I/WUGiOc2qtYI/AAAAAAAAJX8/6hXRYstpCi4E7kOb23QIJ5gHyPpbs4dQwCLcBGAs/s200/resultimportannot.PNG" width="156" height="200" border="0">](https://lh3.googleusercontent.com/-vpFU7b3eS9I/WUGiOc2qtYI/AAAAAAAAJX8/6hXRYstpCi4E7kOb23QIJ5gHyPpbs4dQwCLcBGAs/s1600/resultimportannot.PNG)Hi we need create text anotation with multiline, i found the method CreateTextMarkerAppearance in this group, but only work for highligth, in the image the selected annot is 
underline the rect is fine, but the Appearance is bad, same for the others annots.
1) how we can create the Appearance for Underline, Squiggly, or StrikeOut annotation?
2) how change the background for the viewer,in the ViewerPageViewModel after to select and load pdf in the viewer,
  i try this command pdfViewCtrl.SetDefaultPageColor(Colors.Green);,but don't work, this command 
 pdfViewCtrl.SetBackgroundColor(Colors.Gainsboro);work, but i need change the page background, how do that?

this is part of code 
 
 
Miguel
    case e_Highlight:
        myAnnot = Annot.Create(targetDocument.GetSDFDoc(), e_Highlight, mRect);
        pdftron.PDF.Annots.Highlight highlight = (Highlight)cAnnotationItem.Annot;
                                pdftron.PDF.Annots.Highlight mHighlight = Highlight.Create(targetDocument.GetSDFDoc(), mRect);
                               
                               mHighlight.SetColor(highlight.GetColorAsRGB(), highlight.GetColorCompNum());
                               mHighlight.SetDate(highlight.GetDate());
                               mHighlight.SetCreationDates(highlight.GetCreationDates());
                               mHighlight.SetOpacity(highlight.GetOpacity());
                               mHighlight.SetAppearance(CreateTextMarkerAppearance(searchResults[0].BboxList, highlight.GetColorAsRGB(), page));
                               mHighlight.SetTitle(highlight.GetTitle());
                               string title = highlight.GetTitle(); //how get the author? 
                               page.AnnotPushBack(mHighlight);
                             
                               pdfViewCtrl.UpdateWithAnnot(mHighlight, mHighlight.GetPage().GetIndex());
                               break;
 
                           case e_Underline:
                               myAnnot = Annot.Create(targetDocument.GetSDFDoc(), e_Underline, mRect);
                               pdftron.PDF.Annots.Underline underline = (Underline)cAnnotationItem.Annot;
                               pdftron.PDF.Annots.Underline mUnderline = Underline.Create(targetDocument.GetSDFDoc(), mRect);
 
                               mUnderline.SetColor(underline.GetColorAsRGB(), underline.GetColorCompNum());
                               mUnderline.SetDate(underline.GetDate());
                              
                               //mUnderline.SetAppearance(CreateTextMarkerAppearance(searchResults[0].BboxList,underline.GetColorAsRGB(), page));
                               mUnderline.SetCreationDates(underline.GetCreationDates());
                               mUnderline.SetOpacity(underline.GetOpacity());
                               mUnderline.SetTitle(underline.GetTitle());
                               mUnderline.SetSubject("Underline");
                               //mUnderline.SetBorderStyle(new AnnotBorderStyle(AnnotBorderStyleStyle.e_underline, 1));
                               mUnderline.RefreshAppearance();
                               page.AnnotPushBack(mUnderline);
                             
                               pdfViewCtrl.UpdateWithAnnot(mUnderline, mUnderline.GetPage().GetIndex());
                               Debug.WriteLine(mUnderline.GetRect());
                               break;
                               case e_StrikeOut:
                               myAnnot = Annot.Create(targetDocument.GetSDFDoc(), e_StrikeOut, mRect);
                               pdftron.PDF.Annots.StrikeOut strikeOut = (StrikeOut)cAnnotationItem.Annot;
                               pdftron.PDF.Annots.StrikeOut mStrikeOut = StrikeOut.Create(targetDocument.GetSDFDoc(), mRect);
                               mStrikeOut.SetColor(strikeOut.GetColorAsRGB(), strikeOut.GetColorCompNum());
                               mStrikeOut.SetDate(strikeOut.GetDate());
                               mStrikeOut.SetAppearance(CreateTextMarkerAppearance(searchResults[0].BboxList, mStrikeOut.GetColorAsRGB(), page));
                               mStrikeOut.SetCreationDates(strikeOut.GetCreationDates());
                               mStrikeOut.SetOpacity(strikeOut.GetOpacity());
                               mStrikeOut.SetSubject("StrikeOut");
                               mStrikeOut.SetTitle(strikeOut.GetTitle());
                               page.AnnotPushBack(mStrikeOut);
                              
                               pdfViewCtrl.UpdateWithAnnot(mStrikeOut, mStrikeOut.GetPage().GetIndex());
                               break;
                           case e_Squiggly:
                               myAnnot = Annot.Create(targetDocument.GetSDFDoc(), e_Squiggly, mRect);
                               pdftron.PDF.Annots.Squiggly squiggly = (Squiggly)cAnnotationItem.Annot;
                               pdftron.PDF.Annots.Squiggly mSquiggly = Squiggly.Create(targetDocument.GetSDFDoc(), mRect);
                               mSquiggly.SetColor(squiggly.GetColorAsRGB(), squiggly.GetColorCompNum());
                               mSquiggly.SetDate(squiggly.GetDate());
                               mSquiggly.SetAppearance(CreateTextMarkerAppearance(searchResults[0].BboxList, mSquiggly.GetColorAsRGB(), page));
                               mSquiggly.SetCreationDates(squiggly.GetCreationDates());
                               mSquiggly.SetOpacity(squiggly.GetOpacity());
                               mSquiggly.SetTitle(squiggly.GetTitle());
                               mSquiggly.SetSubject("Squiggly");
                               page.AnnotPushBack(mSquiggly);
                              
                               pdfViewCtrl.UpdateWithAnnot(mSquiggly, mSquiggly.GetPage().GetIndex());
                               break;

// this method only work for highlight annot
public static Obj CreateTextMarkerAppearance(List<Rect> boxes, ColorPt color, Page page)
       {
           var elementBuilder = new ElementBuilder();
           elementBuilder.PathBegin();
 
           boxes.ForEach(box => elementBuilder.Rect(box.x1 - 2, box.y1,
           box.x2 - box.x1 + 2, box.y2 - box.y1 + 2));
 
           Element element = elementBuilder.PathEnd();
 
           element.SetPathFill(true);
           element.SetPathStroke(false);
          
 
           GState elementGraphicState = element.GetGState();
           elementGraphicState.SetFillColorSpace(ColorSpace.CreateDeviceRGB());
           elementGraphicState.SetFillColor(color);
           elementGraphicState.SetBlendMode(GStateBlendMode.e_bl_multiply);
          
 
           var elementWriter = new ElementWriter();
        
           elementWriter.Begin(page.GetSDFObj().GetDoc());
 
           elementWriter.WriteElement(element);
           Obj textMarkerAppearance = elementWriter.End();
 
           elementBuilder.Dispose();
           elementWriter.Dispose();
 
           //Set the bounding box 
           Rect boundingBox = getRectfromList(boxes);
           textMarkerAppearance.PutRect("BBox", boundingBox.x1,
           boundingBox.y1, boundingBox.x2, boundingBox.y2);
           textMarkerAppearance.PutName("Subtype", "Form");
 
           return textMarkerAppearance;
       }
  1. how we can create the Appearance for Underline, Squiggly, or StrikeOut annotation?

You can either adjust the Annotation properties via the available API for each type. Such as color and thickness for example.

Or you can do you own appearance, following this post.
https://groups.google.com/d/msg/pdfnet-sdk/VKV_M2r8c_8/ELadsgU3R9gJ

  1. how change the background for the viewer,in the ViewerPageViewModel after to select and load pdf in the viewer,
    i try this command pdfViewCtrl.SetDefaultPageColor(Colors.Green);,but don’t work, this command
    pdfViewCtrl.SetBackgroundColor(Colors.Gainsboro);work, but i need change the page background, how do that?

PdfViewCtrl.SetDefaultPageColor is the correct API. However, some PDF files explicitly draw their own page background, in which case you will not see your custom color. In other words, the color specified by SetDefaultPageColor only appears on the unpainted locations, or blended with transparent paint operations.

Thanks Ryan for your answer,
solve point 1, but point 2 is pending,Is there any way you can change the background of the document to make it easier to read at night? We need three default (white), sepia, night (black with text white) as in the photo, is there any api for this?



Thanks in advance,
Miguel.
El martes, 20 de junio de 2017, 16:50:26 (UTC-4), Ryan escribió:

  1. how we can create the Appearance for Underline, Squiggly, or StrikeOut annotation?

You can either adjust the Annotation properties via the available API for each type. Such as color and thickness for example.

Or you can do you own appearance, following this post.
https://groups.google.com/d/msg/pdfnet-sdk/VKV_M2r8c_8/ELadsgU3R9gJ

  1. how change the background for the viewer,in the ViewerPageViewModel after to select and load pdf in the viewer,
    i try this command pdfViewCtrl.SetDefaultPageColor(Colors.Green);,but don’t work, this command
    pdfViewCtrl.SetBackgroundColor(Colors.Gainsboro);work, but i need change the page background, how do that?

PdfViewCtrl.SetDefaultPageColor is the correct API. However, some PDF files explicitly draw their own page background, in which case you will not see your custom color. In other words, the color specified by SetDefaultPageColor only appears on the unpainted locations, or blended with transparent paint operations.

Yes, you can do this now. Please see the following post.
https://groups.google.com/d/msg/pdfnet-sdk/tyKu_ns6xlk/_5uGivcBBwAJ

Just what we needed, thank you.