This is a migrated thread and some comments may be shown as answers.

MVC Pdf Content Editing / Spliting

9 Answers 313 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
zeeshan
Top achievements
Rank 1
zeeshan asked on 01 Mar 2017, 11:12 AM

Hello,

I have an MVC application that I would like to take a PDF file and either convert it into HTML, edit the content, and update the new content into a new PDF. 

OR

be able to edit the PDF content and update it into a new PDF file. Would appreciate if you could point to the right Telerik libraries and any examples would be great.I know I can split up pages using the PdfStreamWriter, however editing would need to be done within the page, so splitting is not an option.

Many thanks

9 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 02 Mar 2017, 03:55 PM
Hello,

If you require adding content to existing PDF pages you may use the new PdfStreamWriter API.  You may see sample code for this in PrependAndAppendPageContent  method of this ManipulatePages SDK example

If you require editing the page content by modifying or deleting some specific page elements (deleting concrete text fragments or changing their color for instance), the only possible approach is to import the file as RadFixedDocument, iterate and modify the desired RadFixedPage Content collection and then export the modified RadFixedDocument to new PDF file. However, when doing this, you should be aware that PDF format is fixed document format meaning that all elements have fixed coordinates and deleting some text will not reorder the other text fragments. This fixed content of the PDF format differs it from the flow document formats like DOCX and HTML. Although this guarantees that the content representation will be the same with all applications, devices and operating systems, the fixed coordinates do not allow you to easily edit PDF text content. That is the reason why there is no easy conversion from PDF file to HTML format as well.

I hope this information is helpful.

Regards,
Deyan
Telerik by Progress

0
Umesh
Top achievements
Rank 1
answered on 07 Aug 2017, 03:29 PM

Hi, 

If I have a scanned PDF document with Place holder. Can I read the content and replace the content progrmatically and create a new document?

 

0
Tanya
Telerik team
answered on 10 Aug 2017, 01:48 PM
Hi Umesh,

You could achieve a similar scenario but you should have in mind that a big part of the scanners PDF documents with images instead of with real content. If this is not the case on your end, you can import the scanned document using the PdfFormatProvider class and modify it according to your preferences using the API the library provides. For more information, you can check the documentation of PdfProcessing and the available SDK examples.

When you are ready with the modifications, you can export the new document through the Export() method of the same PdfFormatProvider class.

Hope this helps.

Regards,
Tanya
Progress Telerik

0
Umesh
Top achievements
Rank 1
answered on 10 Aug 2017, 01:52 PM

Hi,

Thank you for the reply. If i by Kendo UI for MVC is then the Pdf Processing SDK is a part of it?

0
Tanya
Telerik team
answered on 10 Aug 2017, 02:03 PM
Hi Umesh,

Yes, all the Telerik Document Processing libraries are included in the UI for ASP.NET MVC suite. You can find more information about the product on our website.

Regards,
Tanya
Progress Telerik

0
Umesh
Top achievements
Rank 1
answered on 25 Aug 2017, 02:29 PM

Hi Tanya,

I was basically evaluating your project before I purchase it. I want to know whether I need to install the telerik package in the webserver where I want to deploy it inorder to use this product. Our webserver is a government webserver and we have no control on installing any components there. I believe refering a dll should work. Please advise.

0
Tanya
Telerik team
answered on 30 Aug 2017, 09:27 AM
Hi Umesh,

A complete installation is not mandatory to use the controls from the suite. You will need just to ensure that the referred assemblies and files are present on the location the references are pointing to.

Regards,
Tanya
Progress Telerik

0
Umesh
Top achievements
Rank 1
answered on 15 Sep 2017, 03:24 PM

Hi ,

 

I need a small help as I am evaluating the telerik product for MVC and am kind of stuck at a place

I want to build a responsive vertical form with kendo UI grid. Can you please provide me a code sample to do that.

A help is appreciated 

My piece of code is as below

<div class="container">
    <div class="row">
     @using (Html.BeginForm("SaveLicenseDetails", "License", FormMethod.Post, new { @class = "form-horizontal" }))
     {
            <fieldset>
                <!-- Form Name -->
                <legend>Form Name</legend>
                <!-- Heading-->
                <div class="form-group">
                    <label for="warning" class="btn btn-warning">Restricted Facility <span class="badge">✓</span></label>
                    <div class="col-md-4">

                        <label class="col-md-4 control-label" for="submit"></label>

                    </div>


                </div>
                <!-- Text input-->
                <!-- Multiple Radios (inline) -->
                <div class="form-group">
                    @Html.LabelFor(model => model.IsLocatedinKensington, new { @class = "col-md-4 control-label" })
                    <div class="col-md-4">
                        <label class="radio-inline" for="reqType-0">
                            @Html.RadioButtonFor(model => model.IsLocatedinKensington, "True", Model.IsLocatedinKensington == true ? new { Checked = "checked" } : null) Yes
                        </label>
                        <label class="radio-inline" for="reqType-1">
                            @Html.RadioButtonFor(model => model.IsLocatedinKensington, "False", Model.IsLocatedinKensington == false ? new { Checked = "checked" } : null) No
                        </label>
                    </div>
                </div>
                <!-- Appended Input-->
                <div class="form-group">
                    @Html.LabelFor(model => model.IsRevenueAuthority, new { @class = "col-md-4 control-label" })
                    <div class="col-md-4">
                        <label class="radio-inline" for="reqType-0">
                            @Html.RadioButtonFor(model => model.IsRevenueAuthority, "True", Model.IsRevenueAuthority == true ? new { Checked = "checked" } : null) Yes
                        </label>
                        <label class="radio-inline" for="reqType-1">
                            @Html.RadioButtonFor(model => model.IsRevenueAuthority, "False", Model.IsRevenueAuthority == false ? new { Checked = "checked" } : null) No
                        </label>
                    </div>
                </div>

                <!-- Appended Input-->
                <div class="form-group">
                    @Html.LabelFor(model => model.IsLocatedinWashningtonGrove, new { @class = "col-md-4 control-label" })
                    <div class="col-md-4">
                        <label class="radio-inline" for="reqType-0">
                            @Html.RadioButtonFor(model => model.IsLocatedinWashningtonGrove, "True", Model.IsLocatedinWashningtonGrove == true ? new { Checked = "checked" } : null) Yes
                        </label>
                        <label class="radio-inline" for="reqType-1">
                            @Html.RadioButtonFor(model => model.IsLocatedinWashningtonGrove, "False", Model.IsLocatedinWashningtonGrove == false ? new { Checked = "checked" } : null) No
                        </label>
                    </div>
                </div>


                <!-- Appended Input-->
                <div class="form-group">
                    @Html.LabelFor(model => model.IsLocatedinDamascus, new { @class = "col-md-4 control-label" })
                    <div class="col-md-4">
                        <label class="radio-inline" for="reqType-0">
                            @Html.RadioButtonFor(model => model.IsLocatedinDamascus, "True", Model.IsLocatedinDamascus == true ? new { Checked = "checked" } : null) Yes
                        </label>
                        <label class="radio-inline" for="reqType-1">
                            @Html.RadioButtonFor(model => model.IsLocatedinDamascus, "False", Model.IsLocatedinDamascus == false ? new { Checked = "checked" } : null) No
                        </label>
                    </div>
                </div>

                <!-- Appended Input-->
                <div class="form-group">
                    @Html.LabelFor(model => model.IsLocatedinLaytonsville, new { @class = "col-md-4 control-label" })
                    <div class="col-md-4">
                        <label class="radio-inline" for="reqType-0">
                            @Html.RadioButtonFor(model => model.IsLocatedinLaytonsville, "True", Model.IsLocatedinLaytonsville == true ? new { Checked = "checked" } : null) Yes
                        </label>
                        <label class="radio-inline" for="reqType-1">
                            @Html.RadioButtonFor(model => model.IsLocatedinLaytonsville, "False", Model.IsLocatedinLaytonsville == false ? new { Checked = "checked" } : null) No
                        </label>
                    </div>
                </div>

                <!-- Appended Input-->
                <div class="form-group">
                    @Html.LabelFor(model => model.IsLocatedinBarnesville, new { @class = "col-md-4 control-label" })
                    <div class="col-md-4">
                        <label class="radio-inline" for="reqType-0">
                            @Html.RadioButtonFor(model => model.IsLocatedinBarnesville, "True", Model.IsLocatedinBarnesville == true ? new { Checked = "checked" } : null) Yes
                        </label>
                        <label class="radio-inline" for="reqType-1">
                            @Html.RadioButtonFor(model => model.IsLocatedinBarnesville, "False", Model.IsLocatedinBarnesville == false ? new { Checked = "checked" } : null) No
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label for="warning" class="btn btn-warning">License Type <span class="badge">✓</span></label>
                    <div class="col-md-4">

                        <label class="col-md-4 control-label" for="submit"></label>

                    </div>


                </div>
                <!-- Multiple Checkboxes (inline) -->

                <!-- Select Basic -->
                <div class="form-group">
                    @Html.LabelFor(model => model.AlcoholTypeNameDisplay, new { @class = "col-md-4 control-label" })
                    <div class="col-md-6">
                        @(Html.Kendo().DropDownList()
               .Name("drpAlcoholType")
               .DataTextField("EntityName")
               .DataValueField("EntityID")
               .BindTo(Model.AlcoholTypeList)
               .OptionLabel("Select a Alcohol Type")
                .Events(e => e.Change("AlcoholTypeChange"))
             .HtmlAttributes(new { style = "width:100%" })
                        )
                    </div>
                </div>

                <!-- Select Basic -->
                <div class="form-group">
                    @Html.LabelFor(model => model.AlcoholServiceDisplay, new { @class = "col-md-4 control-label" })
                    <div class="col-md-6">
                        @(Html.Kendo().DropDownList()
               .Name("drpAlcoholService")
               .DataTextField("EntityName")
               .DataValueField("EntityID")
               .BindTo(Model.AlcoholServiceList)
               .OptionLabel("Select a Alcohol Service")
                .Events(e => e.Change("AlcoholServiceChange"))
             .HtmlAttributes(new { style = "width:100%" })
                        )
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-2 control-label" for="ln"></label>
                    <div id="Licensegrid">
                        <div>

                            @(Html.Kendo().Grid<LicenseTypeModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(lt => lt.OracleClass).ClientTemplate(
                    @"<div class='customer-photo'
                        ></div>
                    <div class='customer-name'>#: OracleClass #</div>")
              .Width(240);
            columns.Bound(c => c.AlcoholService).Filterable(filterable => filterable.UI("AlcoholService")).Title("Type of Alcohol Service").Width(150);
            columns.Bound(c => c.AlcoholType).Filterable(filterable => filterable.UI("AlcoholType")).Title("Type of Alcohol ").Width(150);
            columns.Bound(c => c.ApplicableTo).Width(150).Title("Applicable To");
            columns.Bound(c => c.AnnualFee).Width(150).Format("{0:c}").Title("Annual Fee");
        })
        .HtmlAttributes(new { style = "height: 550px;" })
        .Scrollable()
        .Groupable()
        .Sortable()
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Licenses_Read", "License"))
            .PageSize(20)
        )
                            )


                        </div>
                    </div>

                </div>
                <!-- Button (Double) -->
                <div class="form-group">
                    <label class="col-md-4 control-label" for="submitButton"></label>
                    <div class="col-md-8">
                        <button id="submitButton" name="submitButton" class="btn btn-success">Save</button>
                        <button id="cancel" name="cancel" class="btn btn-inverse">Cancel</button>
                    </div>
                </div>
            </fieldset>
     }
    </div>
</div>

0
Georgi
Telerik team
answered on 21 Sep 2017, 06:26 AM
Hi Umesh,

Please have in mind that it is accepted to not post the same question in different forum threads. This will facilitate other community members to benefit from the forum and we will be able to provide better support service. Thank you in advance for your understanding and cooperation.

Let's continue in the following thread, which topic is related to your question:



Regards,
Georgi
Progress Telerik

Tags
PdfProcessing
Asked by
zeeshan
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Umesh
Top achievements
Rank 1
Tanya
Telerik team
Georgi
Telerik team
Share this question
or