How to run ASP.NET Web Forms C#, .NET Framework 2.0 Demo

Hello,

I have to test viewer. I ran the samples on git but it failed.
Please send the sample source code.
ASP.NET Web Forms C#, .net framework 2.0
If successful, I should buy it right away and go ahead with the project.

email : radian75@prmsys.co.kr

Please reply as soon as possible.

Thanks,
phil


This Topic is created by vladimir.litvinchik using Email to Topic tool.

@philhwanmoon

We provide ASP.NET Web Forms Demo that is available on GitHub. The project is targeting .NET Framework 4.8.

Do you strictly bound to .NET Framework 2.0?

Download a minimal demo project that is targeting .NET Framework 2.0 from Dropbox.

You can evaluate Viewer without a license or request a temporary license. See the Licensing topic for more information.

Yes. I will only add a viewer function to an existing project.
.net framework upgrade is not planned for this project.

Thank you for your help.

@philhwanmoon

Got it, thank you for the feedback!

Hi,

I have a few questions during the test.
I’m running the test with ‘WebFormsMinimal_NET_Framework_2.0’.

1.I need to show the selected file right after loading.
2.The directory select button should be removed.
3.For security reasons, the text of the document should not be copied.

I looked at the source code, but I don’t know which part to modify.
Please help.

@philhwanmoon

There are a couple of options here

  1. Set the default document in the config. Open ConfigHandler.cs and specify the document to open by default e.g. defaultDocument = "resume.docx"
  2. Do the same using query string parameter file e.g. http://localhost:61344/?file=resume.docx

To disable the file browser button Open ConfigHandler.cs and set browse = false.

Two options here:

  1. You can disable right-click on the document in ConfigHandler.cs and set enableRightClick= false.
  2. You can render the document to PNG or JPEG instead of HTML but you won’t be able to perform a search.

Thank you for your kind help.
I’ve tested a few more, and I have a question.

htmlMode = false,
No images are output.
Is it possible to display only some specific pages as images? ex)1-3

watermarkText = “opened by radian75 2022/11/15 12:10”,
No watermark is displayed.

@philhwanmoon

You’re welcome!

I’ve added support for image mode to the sample app.

See the following topics for more information: Render to HTML and Render to PNG or JPEG.

HTML or Image mode is supported.

I’ve also added support for watermarks to the sample app. See Watermark class reference for the supported options.

You’re awesome.

I tested the watermark. However, I only get a screen like the one below.
It seems that it is a temporary license, is it right?
image.png (7.8 KB)

And then, If there are many pages in the document, I would like to implement loading of only some of the pages due to loading time.
I simply implemented it as below, but if there is a better way, please advise.

var pages = new List<PageDesc>();
foreach (var page in viewInfo.Pages)
{
    if (page.Number > 3) { break; }
    pages.Add(new PageDesc
    {
        Width = page.Width,
        Height = page.Height,
        SheetName = page.Name,
        Number = page.Number,
    });
}

Thanks,
Have a good day.
Phil

@philhwanmoon

You’re welcome!

The solution you’ve shared should work well.

Can you please share a complete browser screenshot so I could see how it is rendering?

image.png (344.8 KB)

Send a screen capture. Please advice.

image.png (42.8 KB)

Thank you for your help.

@philhwanmoon

Unfortunately, I can’t reproduce this issue. Here is the output that I’ve got watermark.png (135.6 KB). Can you please make sure you’re using the latest version of a sample app? You can also make sure that Watermark property initialized as following viewOptions.Watermark = new Watermark(WatermarkText);.

I downloaded again.
And then I made sure that the corresponding source code is used.
image.png (113.3 KB)
image.png (263.4 KB)

However, it is not watermarked like the capture.
I think it’s because of the license.

phil.^^

@philhwanmoon

Can you please send me the app you’re running so I can reproduce the issue on my side including a license in case you have it?

I send you my test file.
Thank you for your helps.

@philhwanmoon

Unfortunately, I can’t reproduce this issue on my side but there is a workaround. You can add a watermark using a bit of code.

 viewOptions = new PngViewOptions(
     number => new MemoryStream(),
     (number, stream) =>
     {
         MemoryStream memoryStream = ((MemoryStream)stream);

         AddWatermark(memoryStream, WatermarkText);

         byte[] bytes = memoryStream.ToArray();
         string base64 = Convert.ToBase64String(bytes);

         pages.Add(new Page { Number = number, Data = base64 });
     });

//..

private static void AddWatermark(MemoryStream memoryStream, string watermarkText)
{
    using (Image bitmap = Image.FromStream(memoryStream))
    using (Graphics g = Graphics.FromImage(bitmap))
    {
        g.DrawString(watermarkText,
            new Font("Arial", 20, FontStyle.Regular),
            new SolidBrush(Color.Red),
            new PointF(10, 10));

        memoryStream.SetLength(0);
        bitmap.Save(memoryStream, ImageFormat.Png);
    }
}

Updated application: WebFormsMinimal_NET_Framework_2.0_CustomWatermark.zip

The following image demonstrates the result:

it’s wonderful.

Is it possible to transfer watermark value in Default.aspx.cs?
I can’t use get method and post method for security reasons.

Thank you so much.

@philhwanmoon

The UI is designed in a way that it expects a service that will serve the data using GET and POST methods. The source code of the UI can be found at GitHub - groupdocs-total/GroupDocs.Total-Angular: Angular based UI for GroupDocs Products.

Sorry, I checked the sample source, but I can’t figure out how to use it at all.
I just want to use config of watermark text.

protected const string WatermarkText = "My watermark";

watermarkText = "by roy 2022/12/01",

var config = new
{
    pageSelector = true,
    download = false,
    upload = false,
    print = true,
    browse = true,
    rewrite = false,
    enableRightClick = true,
    defaultDocument = string.Empty,
    *watermarkText = "by roy 2022/12/01",*
    preloadPageCount = 0,
    zoom = true,
    search = true,
    thumbnails = true,
    rotate = false,
    htmlMode = HtmlMode,
    cache = true,
    saveRotateState = true,
    printAllowed = true,
    showGridLines = true,
    cacheFolderName = string.Empty,
    showLanguageMenu = false,
};

@philhwanmoon

I’m sorry for the delayed response. We’ll take a look and update you.